For monitoring purposes I'd like to stream the last N lines of a log file into a Django website interface.
Like displaying the result of a tail -f filename
command.
Basically I'd like to do the same as supervisord which alows to logtail a process from its http interface.
Any idea on how to do that?
As requested by the OP, here is an example using webtail:
$ webtail \
--port=8000 \
--files=/var/log/nginx/error.log,/var/log/nginx/access.log \
--logging=warn
As I understand from the comments - the OP needs a solution that supports websockets. Webtails does. If you look in the webtail.py file:
routes = [(r'/', MainHandler), (r'/tail/', TailHandler),
(r'/signin/', SigninHandler), (r'/signout/', SignoutHandler)]
where TailHandler
is:
from tornado.websocket import WebSocketHandler
....
class TailHandler(WebSocketHandler):
I'm using this for monitoring lots of logs, and it works like a charm :)
if you need in admin panel u can check out django_logtail here.
beside this there is a question here if you interested...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With