Estou tentando rotacionar o log do meu aplicativo diariamente, mas, por algum motivo desconhecido, não está funcionando. Se eu depurar sua definição de logrotate, ele diz que não irá rodá-lo. No entanto, somente quando forço sua rotação, funciona ..
O que estou perdendo aqui?
/tmp/company.0000/application.log {
daily
rotate 7
compress
copytruncate
missingok
extension .log
dateext
dateformat _%Y%m%d
su root valter
create 440 valter valter
}
valter@eniac:~$ ls -ltha /tmp/company.0000/
total 2,8M
drwxrwxrwx 9 root root 96K Aug 30 17:25 ..
drwxrwxr-x 2 valter valter 4,0K Aug 30 17:25 .
-rw-rw-r-- 1 valter valter 2,7M Aug 30 17:00 application.log
valter@eniac:~$ sudo touch -m --date="2016-08-01" /tmp/company.0000/application.log
valter@eniac:~$ ls -ltha /tmp/company.0000/
total 2,8M
drwxrwxrwx 9 root root 96K Aug 30 17:25 ..
drwxrwxr-x 2 valter valter 4,0K Aug 30 17:25 .
-rw-rw-r-- 1 valter valter 2,7M Aug 1 00:00 application.log
valter@eniac:~$ sudo logrotate -d /etc/logrotate.d/application
reading config file /etc/logrotate.d/application
extension is now .log
Handling 1 logs
rotating pattern: /tmp/company.0000/application.log after 1 days (7 rotations)
empty log files are rotated, old logs are removed
switching euid to 0 and egid to 1000
considering log /tmp/company.0000/application.log
log does not need rotating
switching euid to 0 and egid to 0
valter@eniac:~$ sudo logrotate --force /etc/logrotate.d/application
valter@eniac:~$ ls -ltha /tmp/company.0000/
total 264K
drwxrwxr-x 2 valter valter 4,0K Aug 30 17:26 .
-rw-rw-r-- 1 valter valter 0 Aug 30 17:26 application.log
drwxrwxrwx 9 root root 96K Aug 30 17:25 ..
-rw-rw-r-- 1 valter valter 158K Aug 1 00:00 application_20160830.log.gz