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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using rotatelogs for rotating access_log file on IBM HTTP Server

Status
Not open for further replies.

anuptosh

Programmer
Sep 24, 2004
11
GB
hi,

My access_log file of IBM HTTP Server under WAS has grown to a very large size: around 700 MB. I have tried using rotatelogs to generate new logs files on weekly basis.

But, I have encountered certain issues here:

1. I have maintained the default rotating logic i.e. "CustomLog "|/opt/IBMHTTPD/bin/rotatelogs /opt/IBMHTTPD/logs/access_log 604800" common" , but this does not generate new access_log.nnnn file if the webserver does not get http requests for a long time during this time frame. Hence, 604800 secs appears as a misguiding time frame.

2. I have also tried using access_log.%d-%b-%Y-%H-%M 86400" common. This means it should generate access_log file by the name - access_log.30-Apr-2004-00-00, but it does not. It generates file name as access_log.%d-%b-%Y-%H-%M, which is wrong. Is there something I am missing here.

3. I cannot restart the HTTP Server to generate new log files, which appeared as the solution on various websites.

Can somebody provide me with the correct solution to generate the access_log files with correct distinguishing names after certain time intervals using rotatelogs

This is actually urgent !!

Regards,

anuptosh

 
you must send apache a restart signal so it creates the new logs, it will not do it automatically:

/bin/kill -USR1 `cat /usr/local/apache2/logs/httpd.pid 2>/dev/null` 2> /dev/null || true

that is what I use for logrotate. that should go in the logrotate scrip after the log gets rotated so it will restart apache.

The USR1 is a graceful restart, which is recomended. See
here for more info:

Brian
 
Brian,

Thanks for ur feedback.

Will you be able to throw some light on the naming of the Log file generated as raised by me above.

My idea is to write a script that checks for more than one log generated and will then archieve it (not the latest - bcos this is being written into) .. For that reason, I will also check the name of the log files generated.

The log file with the new name does generate automatically i.e after the time interval if there is a http request. This I have done without restarting the HTTP Server.

So, my actual issue is naming the file using rotate logs (not default naming)

Please provide some more inputs on this

anuptosh
 
My apologies, I should have read more carefuly...

according to rotatelogs at , the configuration you have above should work for you. check your error_log and make sure it is not failing for some reason... but this should work:

CustomLog "|/opt/IBMHTTPD/bin/rotatelogs /opt/IBMHTTPD/logs/access_log.%d-%b-%Y-%H-%M 604800" combined
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top