logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.


Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Adjusting Log File Time To Daylight Savings
Author
apishdad



Joined: 01 Jul 2019
Posts: 35
Location: Canada, Toronto

PostPosted: Wed 17 Mar '21 6:00    Post subject: Adjusting Log File Time To Daylight Savings Reply with quote

I wanted to know is there a way to have the custom logging of Apache adjust automatically to Daylight Savings Time

I have my Custom Logging defined as

LogFormat "Time=\"%t\" Referer=\"%{Referer}i\" etc...etc" MyCustomLogFormat
CustomLog "|./bin/rotatelogs.exe C:/Apache24/logs/CustomLog_%Y%m%d%H%M.log 86400 -360" MyCustomLogFormat

The issue is that I live In Toronto and everytime that the Daylight Savings Time switches the time in my log files (Designated by "Time" In the above logformat) are offset by 1 hour, and I need to make that automatic.

Is there a way to do that so that in spring time the parameter in the above customlog goes to -360 (6 hours difference) and in fall it goes to -300 (5 hours difference)
Back to top
tangent



Joined: 16 Aug 2020
Posts: 80
Location: UK

PostPosted: Wed 17 Mar '21 17:19    Post subject: Reply with quote

You've chosen to hard code the offset from UTC in your rotatelogs command, which is therefore fixed when the process starts. So even if you could script changing the parameter from -360 to -300 with daylight savings, it wouldn't take effect without restarting Apache. Not ideal.

Checking https://httpd.apache.org/docs/2.4/programs/rotatelogs.html, why don't you simply use the -l option rather than applying a fixed offset?
    -l Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation.
Back to top


Reply to topic   Topic: Adjusting Log File Time To Daylight Savings View previous topic :: View next topic
Post new topic   Forum Index -> Apache