I have a logrotate running on Aws ec2 instance which is trying to rotate logs under /var/log/tomcat8/ every hour. I have below configuration under /etc/logrotate.d/rotate_tomcat:
"/var/log/tomcat8/localhost_access_log.*-*-*.txt" "/var/log/tomcat8/catalina.*-*-*.log" "/var/log/tomcat8/agent-log.*-*-*.json" "/var/log/tomcat8/ldap-query-log.*-*-*.*.json" {
copytruncate
size 1k
rotate 5
compress
missingok
create 0644 tomcat tomcat
}
When I run this manually, it works as expected. But when I run this as crond, it doesn't do anything. Below is my crond config under /etc/crond.d/accessLogDeletion
*/2 * * * * root logrotate /etc/logrotate.d/rotate_tomcat
Any inputs are appreciated.