December 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Categories

December 2012
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Splitting up Apache Logs for Subdomains

Splitting up Apache Logs for Subdomains

1. Make sure your multiple virtual hosts log to the same log file.

example:@ your config file

ErrorLog “|/usr/sbin/rotatelogs -l /var/log/httpd/linux/error_log.%Y%m%d 86400?CustomLog logs/linux/access_log combinedioCustomLog “|/usr/sbin/rotatelogs -l /var/log/httpd/linux/access_log.%Y%m%d 86400? combinedio

2. Change your Apache LogFormatfrom let say:#LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”” combined

to:LogFormat “%V […]

Delete old logs

#!/bin/sh #Script to remove 10 days old logs # /usr/bin/find /opt/logs -type f -mtime +10 -exec rm {} \;

Tomcat catalina.out Rotate

tail -f catalina.out becomes 2GB in size, tomcat crashes and fails to start without any error message. To avoid this scenario you should rotate catalina.out frequently. This article describes how to setup auto rotation of catalina.out on a linux/unix machine.

How to automatically rotate catalina.out daily or when it becomes bigger than 5M

1. Create […]