【发布时间】:2015-03-29 19:29:45
【问题描述】:
我正在为一些 Web 应用程序编写自己的 logrotate 配置:
/home/me/public_html/logs/*.log {
daily
missingok
rotate 15
compress
delaycompress
notifempty
create 0660 me www-data
nosharedscripts
}
但对这些文件运行 logrotate 会导致:
$ sudo logrotate -d -v *.log
Ignoring logfile1.log because of bad file mode.
Ignoring logfile2.log because of bad file mode.
Ignoring otherlogfile.log because of bad file mode.
Handling 0 logs
$ ls -l
-rw-rw---- 1 me www-data 893584 Jan 27 16:01 logfile1.log
-rw-rw---- 1 me www-data 395011 Jan 27 16:01 logfile2.log
-rw-rw---- 1 me www-data 4949115 Jan 27 16:01 otherlogfile.log
这是否与create 0660 me www-data指定的权限目录中实际日志文件的文件权限有关?
如果我将文件权限更改为 -rw-r----- 并将 create 行更改为
create 0640 me www-data
我明白了
$ sudo logrotate -d -v *.log
Ignoring logfile1.log because the file owner is wrong (should be root).
Ignoring logfile2.log because the file owner is wrong (should be root).
Ignoring otherlogfile.log because the file owner is wrong (should be root).
Handling 0 logs
我的系统是 debian testing/jessie。
【问题讨论】:
标签: logrotate