Forum Moderators: phranque

Message Too Old, No Replies

CustomLog not writing to correct file.

         

larry1301

6:35 pm on Oct 13, 2014 (gmt 0)

10+ Year Member



My access_log and error_log files for my server are not being written to the correct file.

Instead of writing to access_log, it is written to what should be the rotated file. The file currently being written to is access_log-20141013. The previous rotated file is access-log-20141006.

Same Same for error_log. I am running several virtual servers on a dedicated server running CentOS 6 and Apache 2.2.15, PHP 5.3.3 and MySQl 5.1.73

Here is an edited section of the httpd.conf



LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent




<VirtualHost 000.000.00.000:80>
DocumentRoot /var/www/vhosts/zzzzzzz.com/html
ServerName zzzzzzz.com
ServerAlias "www.zzzzzzz.com"

ServerAdmin "webadmin@zzzzzzz.com"
ScriptAlias "/cgi-bin/" "/var/www/vhosts/zzzzzzz.com/cgi-bin/"
CustomLog "/var/www/vhosts/zzzzzzz.com/access_log" "combined"
ErrorLog "/var/www/vhosts/zzzzzzz.com/error_log"

RewriteEngine On
RewriteLogLevel 0
RewriteLog "/var/www/vhosts/zzzzzzz.com/html/logs/rewrite.log"
# format /fp/4/1
RewriteCond %{REQUEST_URI} ^/fp/(.+)/(.+)$
RewriteRule ^/fp/(.+)/(.+) /Frames.php?Type=$1&Use=$2
# format /fdp/4
RewriteCond %{REQUEST_URI} ^/fdp/(.+)$
RewriteRule ^/fdp/(.+) /FrameDetailPage.php?FrameNo=$1

<Directory /var/www/vhosts/zzzzzzz.com/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>




Can anyone point me in the right direction to fix this. Much reading and Googling hasn't lead me anywhere.

wilderness

12:54 am on Oct 14, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Generally speaking, when your referring to "rotating logs", that is accomplished with a "cron job".

I don't see any mention of crons in your inquiry.

larry1301

1:38 am on Oct 14, 2014 (gmt 0)

10+ Year Member



The logs are getting rotated but new entry's to the logs are being written to the wrong file so it doesn't appear to be a cron issue to me.

phranque

4:11 am on Oct 14, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, larry1301!


Instead of writing to access_log, it is written to what should be the rotated file. The file currently being written to is access_log-20141013. The previous rotated file is access-log-20141006.

CustomLog "/var/www/vhosts/zzzzzzz.com/access_log" "combined"


it should be written to access_log as specified in the .conf file.

how are you rotating log files?
i'm guessing there is something happening that involves symbolic links.

larry1301

2:21 pm on Oct 14, 2014 (gmt 0)

10+ Year Member



Here is the script from /etc/logrotate.d/httpd. I didn't think it was a cron problem as some files are being rotated correctly.


# rotate for logfiles that aren't being written correctly
/var/www/vhosts/zzzzzz.com/*log {
missingok
notifempty
sharedscripts
prerotate
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=zzzzzz.com
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

# rotate for these is fine
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}



The first is for the problem ones, the second is for one that works corrrectly.