Reputation: 2389
Is there any tools that catches python logging (socket or http) handlers' reports, and serves a http service so that I can check my logs through a http page?
Thanks
Finally... I found a working server that will do the job...
UPDATE
I found Sentry on github, It seems more sophiscated and production-ready.
Upvotes: 2
Views: 4267
Reputation: 226231
There are many to tools to easily create simple RESTful HTTP webservices. My favorite is itty.
from itty import get, run_itty
import glob, gzip, json, os, functools
def jsonify(origfunc):
@functools.wraps(origfunc)
def wrapper(*args, **kwds):
result = origfunc(*args, **kwds)
return json.dumps(result, indent=4)
return wrapper
@get('/logs')
@jsonify
def list_logfiles(request):
return glob.glob('/var/log/myserver/*.gz')
@get('/logs/(?P<name>\w+)')
def show_logfile(request, name):
fullname = os.path.join('/var/log/myserver', name)
with gzip.open(fullname, 'rb') as f:
return f.read()
run_itty(host='localhost', port=8080)
Upvotes: 2
Reputation: 215
Try Splunk, simple to set up and has a nice interface. You'd listen to your logfiles or simply send logs to splunk. Even works remotly for logs in multiple servers. And you can do a lot more than just checking logs.
Upvotes: 0
Reputation: 11
i recommend you bootle.py is a nice framework for this cases.
Here the link to project website: http://bottlepy.org/docs/dev/
Upvotes: 1