You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Geoff Millikan <gm...@t1shopper.com> on 2013/03/11 00:29:45 UTC

[users@httpd] Apache time zone > daylight saving time > missing an hour of logs?

The date and time shown in Apache logs comes from the time zone of the server.  If the server's time jumps forward an hour
(adjusting for daylight savings time) the time in the Apache log will jump forward too.  To the untrained eye, this may appear as an
1-hour gap in the logs (example below).  But there is no gap - Apache properly logged all requests - no log entries were lost!

For example let us say Apache is busy logging requests and writing the date and time on each log entry.  The seconds are ticking by:
01:59:57, 01:59:58, 01:59:59 and Apache is writing logs in each second.  Now Apache goes to write the next log but before it does,
it retrieves the server time.  The server reports that the time (which is the next second) as 03:00:00.  So Apache without missing a
beat simply writes that time down**.   In other words, the "gap" in the log is not because Apache stopped logging, it is because the
hour did not exist.  

It is generally considered best practice to have Apache (and any other software) record things in UTC time to avoid this issue.
Since there may be many humans viewing the log, it is usually the role of the log analyzer GUI program (like www.analog.cx) to shift
the UTC time into the human's local time as needed for the human's viewing pleasure.

Hope this helps,

Geoff Millikan
http://www.t1shopper.com/

**Story is illustrative only, actual Apache workflow for time handling under the hood probably different.

---= Example "gap" in logs =---
65.55.213.38	-	-	[10/Mar/2013:01:59:51 -0800]	GET /ssi/t1shopper.js HTTP/1.1 <snip>
157.55.32.103	-	-	[10/Mar/2013:01:59:58 -0800]	GET /service/dsl/oh/Hancock.shtml HTTP/1.1 <snip>
74.111.23.38	-	-	[10/Mar/2013:01:59:59 -0800]	GET /tools/port-number/1125 HTTP/1.1 <snip>
157.55.32.103	-	-	[10/Mar/2013:03:00:07 -0700]	GET /us/ga/White%20County.shtml HTTP/1.1 <snip>
74.111.23.38	-	-	[10/Mar/2013:03:00:08 -0700]	GET /tools/port-number/1126/ HTTP/1.1 <snip>

---= Additional background  =---
http://httpd.apache.org/docs/current/mod/mod_log_config.html

http://en.wikipedia.org/wiki/Daylight_saving_time







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache time zone > daylight saving time > missing an hour of logs?

Posted by Tom Evans <te...@googlemail.com>.
On Mon, Mar 11, 2013 at 10:33 AM, Lester Caine <le...@lsces.co.uk> wrote:
> Tom Evans wrote:
>>
>> Don't run Apache in a locale with DST if you do not want local DST
>> times in the logs. Use the C locale instead.
>
>
> The only thing that is consistent is UTC, and by default that should be all
> that is running on a server. A client may well be in the same location, but
> it's the client viewing information that should be the point at which
> DISPLAY of times is modified to a particular time zone view.
>

The only thing that is consistent is that the locale that you run your
programs under, and hence how they format dates, is entirely under the
control of the person running the program.

UTC may well make perfect sense for you, it may not for someone else,
and therefore it should be configurable.

If you want UTC times reported, use a locale that has UTC as the
timezone. Don't use a locale which is subject to DST and then complain
that your logged dates have DST in them!

If you're running windows, then your only option is to set the time
zone on the machine to UTC. On everything that is not windows, running
httpd in the C locale (LC_ALL=C) and/or setting the timezone
(TZ="UTC") has the same effect.

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache time zone > daylight saving time > missing an hour of logs?

Posted by Lester Caine <le...@lsces.co.uk>.
Tom Evans wrote:
> Don't run Apache in a locale with DST if you do not want local DST
> times in the logs. Use the C locale instead.

The only thing that is consistent is UTC, and by default that should be all that 
is running on a server. A client may well be in the same location, but it's the 
client viewing information that should be the point at which DISPLAY of times is 
modified to a particular time zone view.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache time zone > daylight saving time > missing an hour of logs?

Posted by Tom Evans <te...@googlemail.com>.
On Sun, Mar 10, 2013 at 11:29 PM, Geoff Millikan
<gm...@t1shopper.com> wrote:
> The date and time shown in Apache logs comes from the time zone of the server.  If the server's time jumps forward an hour
> (adjusting for daylight savings time) the time in the Apache log will jump forward too.  To the untrained eye, this may appear as an
> 1-hour gap in the logs (example below).  But there is no gap - Apache properly logged all requests - no log entries were lost!
>
> For example let us say Apache is busy logging requests and writing the date and time on each log entry.  The seconds are ticking by:
> 01:59:57, 01:59:58, 01:59:59 and Apache is writing logs in each second.  Now Apache goes to write the next log but before it does,
> it retrieves the server time.  The server reports that the time (which is the next second) as 03:00:00.  So Apache without missing a
> beat simply writes that time down**.   In other words, the "gap" in the log is not because Apache stopped logging, it is because the
> hour did not exist.
>
> It is generally considered best practice to have Apache (and any other software) record things in UTC time to avoid this issue.
> Since there may be many humans viewing the log, it is usually the role of the log analyzer GUI program (like www.analog.cx) to shift
> the UTC time into the human's local time as needed for the human's viewing pleasure.
>
> Hope this helps,
>
> Geoff Millikan
> http://www.t1shopper.com/
>
> **Story is illustrative only, actual Apache workflow for time handling under the hood probably different.
>
> ---= Example "gap" in logs =---
> 65.55.213.38    -       -       [10/Mar/2013:01:59:51 -0800]    GET /ssi/t1shopper.js HTTP/1.1 <snip>
> 157.55.32.103   -       -       [10/Mar/2013:01:59:58 -0800]    GET /service/dsl/oh/Hancock.shtml HTTP/1.1 <snip>
> 74.111.23.38    -       -       [10/Mar/2013:01:59:59 -0800]    GET /tools/port-number/1125 HTTP/1.1 <snip>
> 157.55.32.103   -       -       [10/Mar/2013:03:00:07 -0700]    GET /us/ga/White%20County.shtml HTTP/1.1 <snip>
> 74.111.23.38    -       -       [10/Mar/2013:03:00:08 -0700]    GET /tools/port-number/1126/ HTTP/1.1 <snip>
>
> ---= Additional background  =---
> http://httpd.apache.org/docs/current/mod/mod_log_config.html
>
> http://en.wikipedia.org/wiki/Daylight_saving_time
>

Don't run Apache in a locale with DST if you do not want local DST
times in the logs. Use the C locale instead.

You haven't mentioned even what version of Apache or OS you are using,
so it is hard to suggest concrete advice..

Cheers

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org