Re: Custom Log Format -> Adding milliseconds to timestamp -> %{format}t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 18, 2010 at 10:08:39AM -0800, Geoff Millikan wrote:
> Using %{UNIQUE_ID}e from mod_unique_id is a *great* suggestion if our
> interest was merely identifying each log line uniquely.  However the initial
> question is focused more on the sequence and order of the requests.  Thus, I
> believe a time-based solution is what we're after.  

Well, for sequence and order any quantity that only increases (or only
decreases, for that matter) each time it is sampled, would serve.
Such as a gadget that just hands back the next integer in series every
time it is queried (properly interlocked across threads/processes).
Come to think of it, if you are serving requests fast enough,
milliseconds won't be sufficient.

> This isn't a Linux forum but it seems like *nix would keep time with
> milliseconds in an environmental var somewhere?  Then we could stuff it in
> the log like %{TIME_WITH_MILLISECONDS}e 

Well, not necessarily.  Like most software, Unix was designed in large
part by the hardware it ran on.  My Handbook is at home, so I dunno if
you could get millisecond clocks for PDP-11s back then -- more likely
there would be a jiffy clock, counting the 50/60Hz power cycles (and,
if you were lucky, some way of asking the hardware whether it is set
for 50 or 60Hz.)  The one time source you can rely on finding in
*every* Unix-alike is time(2) which only does seconds.  Most systems
nowadays will have gettimeofday(2) which goes down to microseconds,
and some will do nanoseconds using yet other system calls, such as
clock_gettime(2) specified by POSIX.1.

Actually, though, what would be most significant is:  what will the
Apache Portable Runtime give you?  apr_time_now() returns an
apr_time_t, which is in microseconds, so HTTPD and modules for it
should have access to rather precise time.  But the available
precision will depend on what APR can get from the OS, so you may only
be getting the illusion of microsecond precision while in fact the
value returned jumps by units of 1,000,000 (that is, seconds) or so.

Nah, if there's a mod_serial or something, I would go with that.  Time
is far more complex.

-- 
Mark H. Wood, Lead System Programmer   mwood@xxxxxxxxx
Friends don't let friends publish revisable-form documents.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux