Changes

Linux System Log Rotation

1,543 bytes added, 00:07, 27 April 2013
The following lines were added (+) and removed (-):
 <nowiki>/etc/logrotate.d</nowiki> <nowiki>/etc/logrotate.d</nowiki>== Virtual Host Log Rotation for Apache ==Many linux distributions include a utility called logrotate.d which is installed and configured by default.  It is configured to rotate the main Apache log file typically weekly or monthly.  Yet, Apache configuration for virtual hosts (virtual_host) suggests creating separate logs for each virtual host, and in a directory named for the site.  This is typically under the primary Apache log directory.  Consider a server where /var/log/apache2/access.log is the primary apache log, but there is a virtual host which a log under /var/log/apache2/www.smokinghotbabes.com/access.log. Now looking in /etc/logrotate.d/httpd the default config is: /var/log/apache2/*.log {    missingok    notifempty    postrotate /usr/bin/killall -HUP httpd    endscript }This default installed configuration for logrotate.d/httpd will only rotate the primary web site.  It will not rotate virtual host sites.  This can be amended by adding another part to the log rotation configuration script: /var/log/apache2/*.log {    missingok    notifempty    postrotate /usr/bin/killall -HUP httpd    endscript } /var/log/apache2/*/*.log {    missingok    notifempty    postrotate /usr/bin/killall -HUP httpd    endscript }== External Resources ==* [http://www.thegeekstuff.com/2010/07/logrotate-examples/ HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples]* [http://aaron.kavlie.net/2010/05/server-admin/apache-logs-and-logrotate-d/ Apache logs and logrotate.d]
Bureaucrat, administrator
16,192
edits