Last active
May 26, 2020 18:58
-
-
Save alertedsnake/e13de246ab2facff0b7648a186c37c0e to your computer and use it in GitHub Desktop.
Uwsgi logs in JSON format
This file contains 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
# add 'logfile' to the plugin list | |
plugins = python3,logfile | |
# match logs already in json format | |
logger = applogger stdio | |
log-route = applogger ^{ | |
log-encoder = format:applogger ${msg} | |
log-encoder = nl:applogger | |
# all other logs, we jsonify | |
logger = default stdio | |
log-route = default ^(?!\{) | |
log-encoder = json:default {"timestamp":"${strftime:%%Y-%%m-%%dT%%H:%%M:%%S}", "source":"uwsgi", "levelname":"INFO", "message":"${msg}"} | |
log-encoder = nl:default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be noted that this still won't do all logs - you'll get a few startup messages before the logging kicks in, which look like this: