feature request: no logtail dependency
peterlundberg opened this issue · comments
With logtail not being available everywhere and often a perl implementation, I suggest implementing an embedded python solution which should also simplify process handling etc. Below is a snippet what could be a useful starting point.
with open(filename) as log_fd:
offset_filename = os.path.join(OFFSET_ROOT_DIR,filename)
if not os.path.exists(offset_filename):
os.makedirs(os.path.dirname(offset_filename))
with open(offset_filename, 'w') as offset_fd:
offset_fd.write(str(0))
with open(offset_filename, 'r+') as offset_fd:
log_fd.seek(int(offset_fd.readline()) or 0)
new_logrows_handler(log_fd.readlines())
offset_fd.seek(0)
offset_fd.write(str(log_fd.tell()))
Also, logtail now appears to be deprecated.
http://packages.debian.org/sid/logtail
Is there any recommendation what to use instead of logtail? If not it might make sense to at least provide an optional alternative to it.
+1
+1
+1
This might be useful:
https://pypi.python.org/pypi/pygtail/0.2.1
From the description:
A python "port" of logcheck's logtail2.
+1 to pygtail!
There's a PR for this!