Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
*edit* - Sorry, could a mod please move to the server forum?
Hi All,
I have a site whose "access_log" file is growing rapidly. I'd like to rotate the logs, but I'm not sure how to do so and still be able to run webalizer. I've googled but didn't find any clear instructions.
I looked at rotate logs (piped from apache), but rather then dumping the old log off as a renamed file and continuing with "access_log", it seems to start logging to the alternatively named file which stops webalizer from working.
I run webalizer once a night as a cron job. Could I simply enter a subsequent command to rename "access_log" and then let apache re-create it?
I'd like to run it past you guys first before I start messing about on a live server!
Cheers,
Andy
(For information, the server is CentOS 5 with Apache 2)
Last edited by xMeta4x; 02-21-2008 at 02:51 AM.
Reason: Posted in wrong forum
This is my logrotate script for an Apache web server. It runs at midnight, and I set up a cron job to run at 2 minutes after midnight to run webalizer. I just ignore any missed hits during that 2 minute interval. The logrotate script creates a datestamp filename, for which I have other parsers to further analyze the logs.
The %B appends a month name, and the 2629800 is around the normal number of seconds for a month.
This gets me:
website-access_log.January
website-access_log.February
website-access_log.March
Etc., etc.
I use Analog to do stats and in the configuration file when I tell it what log to look at I can use a wildcard and tell it to look in "path/to/logs/website-access_log.*" and it will analyze all of the logs that match as if they were one big file. Again, not sure about webalizer or how it is configured.
This seems to have deleted a file called access_log.1 (which suggests that logrotate has run before) and created one called access_log.2 and emptied access_log.
Whilst this is good, I wouldn't mind saving the old logs! Could I prevent the historic logs from being deleted?
Logrotate will do a rolling rotation, moving access_log to access_log.1, access_log.1 to access_log.2, and so on. The good news is that you haven't lost any log files, yet. As soon as logrotate reaches its default depth of file retention, it will drop the oldest log files. The 'lastaction' clause that I put into my logrotate script for httpd renames the log files to a date stamped version outside the domain of logrotate, and are thus retained perpetually. I compress a years worth of log files into one zip file and save them.
--- rod.
prerotate will run webalizer then rotate collecting all the data. verify where your webalizer.conf file is... could be /etc/webalizer.conf . This snippet will also rotate them once a month and keep them up for to one year/12 months. it will then compress after the second log has been rotated. the 13th log is also emailed to you before deletion, just add your email address. compression can be important depending on how much traffic and errors. use what you can.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.