These are the docs for uwsgi logformat.


I have several unacceptable choices for outputting a timestamp in the log messages. Is there a way to format YYYY-MM-DD HH-MM-SS.DDDDDD that is just not documented?

  • Nice drive by downvote – boatcoder Oct 19 '17 at 19:33
  • Hi I'm also trying to figure out this log format, what is the six digit number after the timestamp? I'm trying to parse it for log aggregator and I can figure out YYYY-MM-DD:HH:MM:SS part, but not the .DDDDDD part. what is that, milliseconds? pid? – Noon Time Oct 4 '18 at 21:19
  • nevermind. DDDDDD are microseconds (right?) – Noon Time Oct 4 '18 at 21:37

Reading thru the code on github I found an issue that hinted at the solution.

Here is the command line I ended up using

uwsgi --log-date="%Y:%m:%d %H:%M:%S" --logformat-strftime --logformat="%(ftime) %(addr) (%(proto) %(status)) %(method) %(uri) : Retned %(size) bytes in %(msecs) msecs to %(uagent)" --http :9090 --wsgi-file foo.py 

There is virtually no way I could have come up with that by reading the docs. It does require all 3 options (not sure if the order matters) and the use of (%ftime) which is NOT mentioned on the logformat documentation page at all, only in the change log for one of the releases.

It does not appear possible to get the milliseconds in the log line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.