Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pipe the access_log to rotate every 24 hours? 1

Status
Not open for further replies.

stla

IS-IT--Management
Mar 12, 2003
190
DE
My goal is to rotate the access log so that it rotates every 24 hours.

The path to the binaries is /usr/freeware/apache/sbin
and the path to the logs is /usr/freeware/var/log

Where I am struggling is with my command:

"|/usr/freeware/apache/sbin/rotatelogs /usr/freeware/var/log/access_log 86400"

Does my script look correct?
How do I get Apache to execute or recognise this command?

Best regards

 
Put it in your httpd.conf file. See "man rotatelogs":

SUMMARY
rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature. For example:

CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
...


 
Thank you. I found the lines in the httpd.conf files.

I added my command files like this:

CustomLog "|/usr/freeware/apache/sbin/rotatelogs /usr/freeware/var/log/access_log 86400" common

ErrorLog "|/usr/freeware/apache/sbin/rotatelogs /usr/freeware/apache/var/log/error_log 86400"

I then stopped and started apache again.

Instantly a new error log with numerical suffix was generated (error_log.1159315200).

Two questions however:
Q1) Is it correct for the error log command not to have 'common' at the end?

Q2) After restarting, shouldn't there also be a duplicate access_log?

Best regards
 
1. yes. The log formatting only applies to CustomLog
2. Not unless there's a duplicate CustomLog line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top