I have my my application running on apache tomcat. I wanted to configure logrotate for the logs apache creates.
My logrotate config is as follows:
/var/company/apache-tomcat/logs/*.log /var/company/apache-tomcat/logs/*.txt {
su root root
copytruncate
compress
dateext
dateformat -%s
extension gz
missingok
notifempty
rotate 90
daily
}
I just realized that I won't need the copytruncate option for apache logs as apache seems to create a new log file each day with a timestamp appended to it.
eg: localhost.2016-02-26.log
I want logrotate to come in and zip previous logs and delete the them (only keeping the zipped files) and leaving the current log as it is.
Addendum:
Just found out that logrotate is not suitable for rotating logs that have timestamps in them. I am looking for ways in which I can make logrotate work with such logs or other rotating utilities that are more suitable for rotating such logs.