1825552 Members
2584 Online
109681 Solutions
New Discussion юеВ

Re: Apache logs

 
rgoud
Occasional Advisor

Apache logs

Hi list,
I have noticed really big Apache logs on production, what is the best way of manage these logs?
-rw-r--r-- 1 root other 944458063 Apr 24 10:23 ssl_engine_log
-rw-r--r-- 1 root other 976324223 Apr 24 10:23 error_log
-rw-r--r-- 1 root other 66160272 Apr 24 13:04 ssl_request_log
-rw-r--r-- 1 root other 62580157 Apr 24 13:04 access_log
5 REPLIES 5
Uday_S_Ankolekar
Honored Contributor

Re: Apache logs

You can reduce it using logrotate, if it is absoluteley necessary for you.
Otherwise these logs can be deleted and then touch these files so apache can start writing again on these files. Do a tail on these files and see if it contains any important informations.
Logratate can be downloaded from HP's porting centre.

-USA..
Good Luck..
S.K. Chan
Honored Contributor

Re: Apache logs

You can do a search on this forum for various solutions, from scripting it to the tools you can use. Logrotate is one tool and is fairly easy to use.
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
Gregory Fruth
Esteemed Contributor

Re: Apache logs

Apache comes with a program called "rotatelogs"
which can be used for this purpose. See:

http://httpd.apache.org/docs/logs.html#piped
http://httpd.apache.org/docs-2.0/logs.html#piped

If you don't mind restarting Apache, you can
write a script using "apachectl" or modify
"apachectl" itself to rotate the logs. See:

http://httpd.apache.org/docs/logs.html#rotation
http://httpd.apache.org/docs-2.0/logs.html#rotation

HTH
Decio Miname
Frequent Advisor

Re: Apache logs

In case you are to make your own custom rotate solution...
Some older versions of Apache access the logs by their i-node reference, not the log's filenames. The effect was: if you moved the logs to .old or anything like that (in the same filesystem), the old log continued to be written, even after you created the new one. If you removed the old log (after copying it to somewhere else, for example), Apache would go crazy even if you created the new log immediately after. The problem would never happen if you zeroed the log file without changing the i-node reference (for example, issuing a "> access_log" command).
I've observed that on 1.1 times; it doesn't happen anymore on 1.3.19 (which is not so new) and above, but I don't know exactly which version fixed that.
Steven E. Protter
Exalted Contributor

Re: Apache logs

I generate web visit stats for my customers based on thee access logs.

At midnight month end, I move the files to a work location, touch the original locations to start the files fresh for the next month and life goes on.

Here's the script. Attached.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com