Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: Apache logs in UTC/GMT | 
 |   
| Author | 
  | 
 
Yoann
 
 
  Joined: 02 May 2008 Posts: 2
 
  | 
 Posted: Fri 02 May '08 18:47    Post subject: Apache logs in UTC/GMT | 
     | 
 
  | 
 
I'm running Apache 2.0.63 on Windows 2000 SP4 set to the Eastern Time Zone with DST updates. I'm trying to get Apache's logs in UTC/GMT so I can sync them up with other UTC logs I have.
 
 
I've tried setting the TZ environment variable to both "UTC" and "GMT" for the whole system as well as for the user Apache runs under, but nothing takes. It always logs the current local time. The response headers are in UTC, but I can't get the logs to use that time. From what I read, using "SetEnv TZ UTC" in the httpd.conf file would only affect CGI scripts, which I don't want using UTC time.
 
 
Any ideas?
 
 
Thanks! | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 02 May '08 19:55    Post subject:  | 
     | 
 
  | 
 
You can change that
 
 
 	  | Quote: | 	 		  
 
[day/month/year:hour:minute:second zone]
 
day = 2*digit
 
month = 3*letter
 
year = 4*digit
 
hour = 2*digit
 
minute = 2*digit
 
second = 2*digit
 
zone = (`+' | `-') 4*digit
 
 | 	  
 
 
for more details see http://httpd.apache.org/docs/2.0/logs.html
 
if you still have a question please ask again. | 
 
  | 
 
| Back to top | 
 | 
 
Yoann
 
 
  Joined: 02 May 2008 Posts: 2
 
  | 
 Posted: Fri 02 May '08 20:37    Post subject:  | 
     | 
 
  | 
 
That portion of the manual explains how the default date/time is formatted, which includes how the system time zone will be displayed. Using a LogFormat directive with strftime formatting also just formats the local time; it doesn't convert it to UTC.
 
 
I took a look at the Apache Windows source, and the logging portions appear to convert the request's UTC time to a local time using the time zone info from the system's Registry. Based on that info, it would seem impossible to have the log times in UTC without changing the system over to UTC as well.
 
 
Any other ideas?
 
 
Thanks. | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7443 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Mon 05 May '08 10:06    Post subject:  | 
     | 
 
  | 
 
I've searched a lot this weekend in the internet and took a look that the apache code.
 
Your only chance is to change the system (OS) time to UTC. | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |