httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "From Laura" <from_la...@hotmail.com>
Subject Re: access_log file permission question
Date Mon, 03 Jun 2002 17:11:57 GMT
I believe I found the answer in case it comes up in the future.

Log Rotation
....   rotate the log files by moving or deleting the existing logs. This 
cannot be done while the server is running, because Apache will continue 
writing to the old log file as long as it holds the file open. Instead, the 
server must be restarted after the log files are moved or deleted so that it 
will open new log files.

By using a graceful restart, the server can be instructed to open new log 
files without losing any existing or pending connections from clients.  
However, in order to accomplish this, the server must continue to write to 
the old log files while it finishes serving old requests. It is therefore 
necessary to wait for some time after the restart before doing any 
processing on the log files. A typical scenario that simply rotates the logs 
and compresses the old logs to save space is:

mv access_log access_log.old
mv error_log error_log.old
apachectl graceful
sleep 600
gzip access_log.old error_log.old

Source: http://httpd.apache.org/docs/logs.html

Note that linux will still let you rename the log, copy it, etc... without 
giving any error message like "file locked."  We even renamed access_log to 
access_log.old, recreated access_log and hit the website.  Guess what?  
access_log.old continued growing in size, registering hits, while access_log 
remained empty.






>From: "From Laura" <from_laura@hotmail.com>
>Reply-To: users@httpd.apache.org
>To: users@httpd.apache.org
>Subject: access_log file permission question
>Date: Fri, 31 May 2002 11:17:19 -0400
>
>Hello and thank you to anyone who can help me with this:
>
>I had five access logs under /var/log/httpd.
>ls -al showed:
>-rw-r--r--    1 root     root     17917498 May 31 09:56 access_log
>-rw-r--r--    1 root     root     34607445 May 26 04:02 access_log.1
>-rw-r--r--    1 root     root     22416686 May 19 03:55 access_log.2
>-rw-r--r--    1 root     root     27256857 May 10 17:57 access_log.3
>-rw-r--r--    1 root     root     33531993 May  5 04:02 access_log.4
>
>I know that logrotate is generating the copies and this is fine.  I wanted
>to do some testing of my own rotation script so I copied access_log to
>access_log.0 as root (not wanting to overwrite it).  Then I recreated a
>blank access_log file.  So, in short:
>$  cp access_log  access_log.0
>$  touch access_log
>
>Note: I checked the file permissions - access_log was the same as it was
>before, -rw-r--r-- .
>
>I then accessed the web page and checked the filesize of access_log.  I did
>not increase in size.  I then added write permissions on the group and it
>began logging(/filesize grew).
>
>Question - how did access_log work successfully before doing this?  My
>error_log file had only this to say:
>
>[Thu May 30 04:02:05 2002] [warn] child process 2909 did not exit, sending
>another SIGHUP
>[Thu May 30 04:02:05 2002] [warn] child process 2910 did not exit, sending
>another SIGHUP
>[Thu May 30 04:02:05 2002] [warn] child process 2911 did not exit, sending
>another SIGHUP
>[Thu May 30 04:02:05 2002] [notice] SIGHUP received.  Attempting to restart
>[Thu May 30 04:02:08 2002] [notice] Apache/1.3.20 (Unix)  (Red-Hat/Linux)
>mod_python/2.7.6 Python/1.5.2 mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2
>PHP/4.0.6 mod_perl/1.24_01 mod_throttle/3.1.2 configured -- resuming normal
>operations
>
>***************************************  Thanks for your help!!!
>
>_________________________________________________________________
>Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message