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: Adjusting Log File Time To Daylight Savings |
|
Author |
|
apishdad
Joined: 01 Jul 2019 Posts: 44 Location: Canada, Toronto
|
Posted: Wed 17 Mar '21 6:00 Post subject: Adjusting Log File Time To Daylight Savings |
|
|
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 Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Wed 17 Mar '21 17:19 Post subject: |
|
|
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 |
|
|
|
|
|
|