This patch was released upstream to the nginx team at:
http://forum.nginx.org/read.php?2,5137
This patch is made available under the same license used for nginx,
the BSD license.
The patch implements the following:
For every named log format there may be defined a custom timestamp format
that will be passed to strftime() for expansion. This string is accessed
via $time_custom instead of $time_local. (It defaults to expanding to an
empty string unless the user specifies a time_custom_format value for the
named log format.) Inside the custom format one extra variable expansion
is supported: the use of "$ms" will substitute a 3-digit milliseconds
value at that point.
For example:
log_format main '$remote_addr - $remote_user [$time_custom] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
time_custom_format main '%d/%b/%Y:%H:%M:%S.$ms %z';
That defines a log format that is like $time_local except that it gets
millisecond logging resolution. Obviously, the string doesn't need to
be quite so similar to the default, but you get the idea.