Cleaning a few things up
Sometimes you just get burned out on work and no matter what you do you can seem to get your head back in the game. Today has been one of those days for me. So I’m trying to muddle through as best I can. That means working on unfinished things in the hopes of getting some them off my plate completely. Today that meant working some more with mod_security to cut down on the spam getting to the Libraries weblogs. A piece of this was to make sure that the log files for mod_security don’t get too big. Normally, I deal with Apache log files using a program called cronolog. However, it didn’t seem like this could work for the audit_log that mod_security creates because it is different format from the other log files. So I went out digging and found the Linux has a built-in program for rotating logs called logrotate. Further surfing on the web helped me determine that there is a specific file for configuring how logrotate deals with Apache log files, /etc/logrotate.d/apache2 . I read the man (manual) pages for logrotate and added some new lines to this file for my audit_log.
/path/to/audit_log {
daily
dateext
maxage 30
rotate 10
size=+100M
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
}
I thought that I did this correctly but after waiting overnight to see. It didn’t work. So I took out the size=+100M line and am waiting to see if this change made the difference.
I also cleared up an error with my script that was moving server log files to another server for log analysis. To do this I needed to figure out what the name of the script that was moving the files. So I opened up crontab to see what was running when. From this I determined the name of the script and was then able to edit it.
If you run *nux servers cron is a important program to know. It is a little like “Scheduled Tasks in Windows” in that it it allows you to schedule things to happen at certain times. At the Libraries we use it to move our log files but it is also the foundation of how we run backups in the sense that it kicks the backups off at a certain time. I’ve come to rely on it some much I’ve been thinking about asking LISHost if I can set up my own crontab and scripts for my site. The crontab can be a little intimidating but there is a old but good tutorial over at ONLamp.com that explains the basics.