Ask HN: Best approach to Apache logging?
I set up a virtual server on Linode recently, and mimicked their suggested Virtual Host settings like so:
ErrorLog /srv/www/ducklington.org/logs/error.log
CustomLog /srv/www/ducklington.org/logs/access.log combined
However I've discovered that this is not an ideal setup -- on the main site running on this server, the access log has grown to 1.8GB in just a couple of weeks!For that reason, Apache docs recommend log rotation:
CustomLog "|/usr/local/apache/bin/rotatelogs
/var/log/access_log 86400" common
This would have to be modified of course, for distro-specific location of the rotatelogs command, desired location for the log file, and rotation interval.So how do you handle log rotation? As above from the Apache docs, or with some other method? And while we're at it, any other customization you've done (formatting, etc.)?
2 comments
[ 3.4 ms ] story [ 14.6 ms ] threadA single line added to the apache2 file under /etc/logrotate.d and I think all my logs are covered.