Created
March 13, 2012 11:46
-
-
Save ikeikeikeike/2028340 to your computer and use it in GitHub Desktop.
django logging fluentd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': "%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]" | |
}, | |
}, | |
'handlers': { | |
'fluentinfo':{ | |
'level':'INFO', | |
'class':'fluent.handler.FluentHandler', | |
'formatter': 'verbose', | |
'tag':'app.info', | |
'host':'localhost', | |
'port':24224, | |
# 'timeout':3.0, | |
# 'verbose': False | |
}, | |
'fluentdebug':{ | |
'level':'DEBUG', | |
'class':'fluent.handler.FluentHandler', | |
'formatter': 'verbose', | |
'tag':'app.debug', | |
'host':'localhost', | |
'port':24224, | |
# 'timeout':3.0, | |
'verbose': True | |
}, | |
}, | |
'loggers': { | |
'app.debug': { | |
'handlers': ['fluentdebug'], | |
'level': 'DEBUG', | |
'propagate': True, | |
}, | |
'app.info': { | |
'handlers': ['fluentinfo'], | |
'level': 'DEBUG', | |
'propagate': True, | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for future googlers :)
if you using fluentd to send log entries to elasticsearch (via fluent-plugin-elasticsearch), you must use fluent.handler.FluentRecordFormatter formatter. Coz fluent-plugin-elasticsearch wants pure json as log entry.
Something like this: