[uWSGI] JSON logging config

Jay Wineinger jay.wineinger at gmail.com
Tue Nov 14 23:35:47 UTC 2017


Hi,

I have a python application that I'm running under uWSGI. I'm trying to
configure JSON logs throughout my stack. I've already configured python to
output log lines as JSON, but I'm having trouble with uWSGI. If I use the
json log encoder, the python logs are output as a JSON string nested within
the structure I defined in the log-encoder line.  For example, notice the
"msg" key below is a string:

{"src":"uwsgi", "msg":"{\"asctime\": \"2017-11-14 23:21:32,656\",
\"request_id\": \"f250b05f3a1c4cc2a4daaa6a3f818ab7\", \"levelname\":
\"INFO\", \"message\": \"method=GET path=/up status=200\"}",
"date":"2017-11-14T23:21:32"}

My ideal solution would be to have my application logs on their own lines,
not wrapped by uwsgi, and then have separate uwsgi JSON log lines. My next
preference would be to have nested JSON in the sample above, not the
encoded string.

Does anyone know how I might get the output I want?  I'd rather not resort
to shipping the logs to another container, but that seems to be a somewhat
viable option.

thanks!

Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20171114/0fb3ca73/attachment.html>


More information about the uWSGI mailing list