How to manage log files using logrotate

Reference

https://www.linode.com/docs/uptime/logs/use-logrotate-to-manage-log-files/

https://confluence.atlassian.com/jirakb/configure-log-rotation-for-the-catalina-log-in-jira-server-224398003.html

Use logrotate to automatically rotate old files to manage the size of the log and also automatically remove older logs.

Create configuration file in /etc/logrotate.d/new-logrotate.conf

Example of log rotate config

/opt/atlassian/jira/logs/catalina.out {
	rotate 5
	size 20M
	nocompress
	notifempty
	missingok
	copytruncate
	su THE_USER THE_GROUP
}

To perform a test rotation

logrotate --force etc/logrotate.d/new-logrotate.conf