Site icon LCDUNG

How to rotate the Tomcat catalina log file

By default, Confluence applications mirror the application log output (atlassian-confluence.log) to the Tomcat log file, catalina.out. This file can grow quite large and cannot be rotated by JIRA applications using Log4j configuration.

# 1. Check that your system has logrotate installed:
which logrotate

# 2. Purge the contents of catalina.out.
echo > /opt/atlassian/confluence/logs/catalina.out

# 3. Find the user and group that is set for the parent directory:
ls -la /opt/atlassian/confluence/logs

# 4. Create a file at /etc/logrotate.d/confluence-tomcat.conf
/opt/atlassian/confluence/logs/catalina.out {
	rotate 5
	size 20M
	nocompress
	notifempty
	missingok
	copytruncate
	su THE_USER THE_GROUP
}

# 5. Perform a test rotation:
logrotate --force /etc/logrotate.d/confluence-tomcat.conf

# 6. Verify it's working correctly by checking that there are now two files, catalina.out and catalina.out.1:
ls /opt/atlassian/confluence/logs | grep catalina.out
Exit mobile version