由于权限问题,Logrotate 无法工作。
● logrotate.service - Rotate log files
Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2024-04-23 00:00:08 UTC; 5h 17min ago
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
man:logrotate.conf(5)
Process: 208154 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
Main PID: 208154 (code=exited, status=1/FAILURE)
Apr 23 00:00:08 ip-172-31-11-23 systemd[1]: Starting Rotate log files...
Apr 23 00:00:08 ip-172-31-11-23 logrotate[208154]: error: unable to open /presto_webapp/log/production.log.1 for compression
Apr 23 00:00:08 ip-172-31-11-23 systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Apr 23 00:00:08 ip-172-31-11-23 systemd[1]: logrotate.service: Failed with result 'exit-code'.
Apr 23 00:00:08 ip-172-31-11-23 systemd[1]: Failed to start Rotate log files
日志文件的权限如下
-rw-rw-rw- 1 ubuntu root 7.1G Apr 23 05:39 production.log
-rw-rw-rw- 1 ubuntu root 911M Mar 11 10:01 production.log.1
日志轮换配置如下
/presto_webapp/log/*.log {
daily
missingok
rotate 180
compress
delaycompress
notifempty
copytruncate
}
请帮助修复此问题。