I am having an issue with my webserver, in that the logs that apache is writing have a different timestamp then my machine. This is causing some issues with other services parsing this file..
[email protected]:/logs/httpd/example.com# date
Thu Nov 10 10:56:12 EST 2016
[email protected]:/logs/httpd/example.com# tail -n 1 whatismyip.insecure_access.log
99.99.99.99 - - [10/Nov/2016:09:56:01 -0600] "GET / HTTP/1.1" 200 11 "-" "curl/7.29.0"
/\ EST Should be -0500
I am unsure what to change next:
[email protected]:/logs/httpd/example.com# ll /etc/localtime
lrwxrwxrwx. 1 root root 38 Oct 28 2015 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
[email protected]:/etc/httpd# grep "TZ" /etc/httpd/* -r
/etc/httpd/conf/httpd.conf:SetEnv TZ America/New_York
Binary file /etc/httpd/modules/mod_wsgi.so matches
Binary file /etc/httpd/modules/mod_substitute.so matches
Binary file /etc/httpd/modules/libphp5.so matches
How can I fix the logged timestamp to be in sync with my local time?
If the webserver is running with php you can also have a look in:
/etc/php.ini
Add time zone by adding or modifying a line like:
date.timezone="America/New_York"
restart apache
/etc/init.d/httpd restart