일일 로그 회전 중에 다음 오류가 발생합니다.
/usr/bin/find: cannot delete ‘/var/log/tomcat/catalina.out’: Permission denied error: error running non-shared postrotate script for /var/log/tomcat/xdlogger.log of '/var/log/tomcat/*.log'
이것이 내 logrotate 구성입니다.
# cat /etc/logrotate.d/tomcat
/var/log/tomcat/*.txt
/var/log/tomcat/*.log
/var/log/tomcat/catalina.out {
copytruncate
daily
dateext
rotate 3
compress
missingok
postrotate
/usr/bin/find /var/log/tomcat/ -type f ! -name 'catalina.out' -mtime +5 -delete
endscript
}
catalina.out과 xdlogger.log의 권한은 다음과 같습니다.
# stat /var/log/tomcat/catalina.out
File: `/var/log/tomcat/catalina.out'
Size: 16061 Blocks: 32 IO Block: 4096 regular file
Device: fd05h/64773d Inode: 41 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 70/ www) Gid: ( 0/ root)
Access: 2019-07-11 03:17:16.056809957 -0500
Modify: 2019-07-11 07:14:48.331588384 -0500
Change: 2019-07-11 07:14:48.331588384 -0500
# stat /var/log/tomcat/xdlogger.log
File: `/var/log/tomcat/xdlogger.log'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd05h/64773d Inode: 1433 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 70/ www) Gid: ( 70/ www)
Access: 2019-07-11 03:17:16.044810362 -0500
Modify: 2019-07-11 03:17:16.044810362 -0500
Change: 2019-07-11 03:17:16.044810362 -0500
내가 어디서 잘못되었는지 알려주세요.