How do I configure Apache 2.0's log format so that it timestamps each request log with millisecond (or microsecond) accuracy? The docs say that timestamps are specified in strftime format and strftime doesn't seem to handle anyting smaller than seconds.
Asked
Active
Viewed 7,753 times
4
-
How can anything more refined that a second be useful an any way, especially when it takes 100ms easily for something to spit across the net. This just seems a touch obsessive. – TravisO Dec 02 '08 at 21:47
-
100ms is less than one second, TravisO. I'm currently working on a load throttling system that requires millisecond accuracy. – Seun Osewa Jan 25 '10 at 15:53
-
1This has been asked again and answered here on stackoverflow: [Increase precission of apache log to include milliseconds][1] [1]: http://stackoverflow.com/questions/15405719/increase-precission-of-apache-log-to-include-milliseconds – Apr 20 '13 at 02:46
2 Answers
2
I don't think it's possible (without rewriting APR, atleast). Apache uses apr_strftime. On Unix, this calls the C library's strftime, but doesn't even fill milliseconds into struct tm (not surprisingly, because this structure doesn't usually support milliseconds in the first place). The Windows versions isn't much different.

Ron Harlev
- 16,227
- 24
- 89
- 132

Martin v. Löwis
- 124,830
- 17
- 198
- 235
-
1
-
2As MikeT already pointed out, you _can_ get this on Apache 2.4, if you use %{msec_frac}t in your CustomLog format: http://httpd.apache.org/docs/current/mod/mod_log_config.html#formats Apache 2.2 (not to mention 2.0) users are left in the cold. – Marius Gedminas Oct 02 '13 at 14:44
-1
use %D option for microsecond accuracy
-
2That measures the time taken to process each request, and not the timestamp for each request. – Seun Osewa Jan 25 '10 at 15:50