- 论坛徽章:
- 6
|
哪位大神指导下logrotate的配置吧。我用nagios日志做这个的测试,为何总是无法生成新的日志文件
环境:
centos7
配置:- [root@localhost logrotate.d]# cat nagios
- # Important! Nagios rotates its own logs. Only enable this logrotate if you
- # know what you are doing!
- # For more information please see "log_rotate_method" in:
- /etc/nagios/nagios.cfg
- # ----- logrotate config -------------
- /var/log/nagios/*.log {
- missingok
- weekly
- notifempty
- size 10k
- nocompress
- olddir /tmp/nagios
- create 0600 root root
- }
复制代码 命令:- [root@localhost logrotate.d]# logrotate ./nagios -v -d
- reading config file ./nagios
- olddir is now /tmp/nagios
- Handling 1 logs
- rotating pattern: /etc/nagios/nagios.cfg
- # ----- logrotate config -------------
- /var/log/nagios/*.log 10240 bytes (no old logs will be kept)
- olddir is /tmp/nagios, empty log files are not rotated, old logs are removed
- considering log /etc/nagios/nagios.cfg
- log does not need rotating
- considering log #
- log # does not exist -- skipping
- considering log -----
- log ----- does not exist -- skipping
- considering log logrotate
- log logrotate does not exist -- skipping
- considering log config
- log config does not exist -- skipping
- considering log -------------
- log ------------- does not exist -- skipping
- considering log /var/log/nagios/nagios.log
- log needs rotating
- rotating log /var/log/nagios/nagios.log, log->rotateCount is 0
- dateext suffix '-20150122'
- glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
- renaming /tmp/nagios/nagios.log.1 to /tmp/nagios/nagios.log.2 (rotatecount 1, logstart 1, i 1),
- renaming /tmp/nagios/nagios.log.0 to /tmp/nagios/nagios.log.1 (rotatecount 1, logstart 1, i 0),
- fscreate context set to system_u:object_r:nagios_log_t:s0
- renaming /var/log/nagios/nagios.log to /tmp/nagios/nagios.log.1
- disposeName will be /tmp/nagios/nagios.log.1
- creating new /var/log/nagios/nagios.log mode = 0600 uid = 0 gid = 0
- [color=Red]removing old log /tmp/nagios/nagios.log.1
- error: error opening /tmp/nagios/nagios.log.1: No such file or directory[/color]
复制代码 这里总是报错,权限什么的倒是看过了,还有哪里该注意的地方? |
|