How to log the time in the UTC time format?

rmalayter nginx-forum at nginx.us
Fri Dec 4 18:11:19 MSK 2009


Maxim Dounin Wrote:
-------------------------------------------------------
> BTW, could you please explain why do you need time
> in this particular 
> format?

Many log parsing and event correlation tools need the time with miliseconds, which $time_local doesn't produce. However, many of these tools also cannot hanlde the "number if miliseconds since start of UNIX time" that nginx produces with $msec.

A nice option would be to output ISO-8601 format time stamps in logs, which just about every tool can handle, such as this:
2009-12-04T13:48:22.432Z

These are also human-readable time stamps that include miliseconds, which is nice. Even Microsoft IIS can do this.

See:
http://en.wikipedia.org/wiki/ISO_8601

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,26862,27966#msg-27966





More information about the nginx mailing list