在logrotate.d下创建了如下文件测试时,却报如下错误求解
- # cat /etc/logrotate.d/httpd
- /usr/local/apache2/logs/discuz-error_log {
- weekly
- create 0644 root root
- minsize 1M
- rotate 1
- prerotate
- /usr/local/apache2/bin/apachectl graceful
- endscript
- }
- /usr/local/apache2/logs/discuz-access_log {
- daily
- create 0644 root root
- rotate 5
- prerotate
- /usr/local/apache2/bin/apachectl graceful
- endscript
- }
- # logrotate -vf /etc/logrotate.d/httpd
- reading config file /etc/logrotate.d/httpd
- reading config info for /usr/local/apache2/logs/discuz-error_log
- reading config info for /usr/local/apache2/logs/discuz-access_log
- Handling 2 logs
- rotating pattern: /usr/local/apache2/logs/discuz-error_log forced from command line (1 rotations)
- empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
- considering log /usr/local/apache2/logs/discuz-error_log
- log needs rotating
- rotating log /usr/local/apache2/logs/discuz-error_log, log->rotateCount is 1
- dateext suffix '-20160201'
- glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
- renaming /usr/local/apache2/logs/discuz-error_log.1 to /usr/local/apache2/logs/discuz-error_log.2 (rotatecount 1, logstart 1, i 1),
- old log /usr/local/apache2/logs/discuz-error_log.1 does not exist
- renaming /usr/local/apache2/logs/discuz-error_log.0 to /usr/local/apache2/logs/discuz-error_log.1 (rotatecount 1, logstart 1, i 0),
- old log /usr/local/apache2/logs/discuz-error_log.0 does not exist
- log /usr/local/apache2/logs/discuz-error_log.2 doesn't exist -- won't try to dispose of it
- running prerotate script
- Syntax error on line 34 of /usr/local/apache2/conf/extra/httpd-vhosts.conf:
- Invalid command 'Indexes', perhaps misspelled or defined by a module not included in the server configuration
- error: error running non-shared prerotate script for /usr/local/apache2/logs/discuz-error_log of '/usr/local/apache2/logs/discuz-error_log '
- rotating pattern: /usr/local/apache2/logs/discuz-access_log forced from command line (5 rotations)
- empty log files are rotated, old logs are removed
- considering log /usr/local/apache2/logs/discuz-access_log
- log needs rotating
- rotating log /usr/local/apache2/logs/discuz-access_log, log->rotateCount is 5
- dateext suffix '-20160201'
- glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
- renaming /usr/local/apache2/logs/discuz-access_log.5 to /usr/local/apache2/logs/discuz-access_log.6 (rotatecount 5, logstart 1, i 5),
- old log /usr/local/apache2/logs/discuz-access_log.5 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.4 to /usr/local/apache2/logs/discuz-access_log.5 (rotatecount 5, logstart 1, i 4),
- old log /usr/local/apache2/logs/discuz-access_log.4 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.3 to /usr/local/apache2/logs/discuz-access_log.4 (rotatecount 5, logstart 1, i 3),
- old log /usr/local/apache2/logs/discuz-access_log.3 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.2 to /usr/local/apache2/logs/discuz-access_log.3 (rotatecount 5, logstart 1, i 2),
- old log /usr/local/apache2/logs/discuz-access_log.2 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.1 to /usr/local/apache2/logs/discuz-access_log.2 (rotatecount 5, logstart 1, i 1),
- old log /usr/local/apache2/logs/discuz-access_log.1 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.0 to /usr/local/apache2/logs/discuz-access_log.1 (rotatecount 5, logstart 1, i 0),
- old log /usr/local/apache2/logs/discuz-access_log.0 does not exist
- log /usr/local/apache2/logs/discuz-access_log.6 doesn't exist -- won't try to dispose of it
- running prerotate script
- Syntax error on line 34 of /usr/local/apache2/conf/extra/httpd-vhosts.conf:
- Invalid command 'Indexes', perhaps misspelled or defined by a module not included in the server configuration
- error: error running non-shared prerotate script for /usr/local/apache2/logs/discuz-access_log of '/usr/local/apache2/logs/discuz-access_log '
0
本帖最后由 starry 于 2016-2-1 16:14 编辑
{:7_193:} 解决了 上面的报错信息 只是 在使用indexes参数时没加上Options参数
Options Indexes
Order deny,allow
Deny from all
重新执行,日志切割成功
{:7_193:} 解决了 上面的报错信息 只是 在使用indexes参数时没加上Options参数
Options Indexes
Order deny,allow
Deny from all
重新执行,日志切割成功
- # logrotate -vf /etc/logrotate.d/httpd
- reading config file /etc/logrotate.d/httpd
- reading config info for /usr/local/apache2/logs/discuz-error_log
- reading config info for /usr/local/apache2/logs/discuz-access_log
- Handling 2 logs
- rotating pattern: /usr/local/apache2/logs/discuz-error_log forced from command line (1 rotations)
- empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed
- considering log /usr/local/apache2/logs/discuz-error_log
- log needs rotating
- rotating log /usr/local/apache2/logs/discuz-error_log, log->rotateCount is 1
- dateext suffix '-20160201'
- glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
- renaming /usr/local/apache2/logs/discuz-error_log.1 to /usr/local/apache2/logs/discuz-error_log.2 (rotatecount 1, logstart 1, i 1),
- old log /usr/local/apache2/logs/discuz-error_log.1 does not exist
- renaming /usr/local/apache2/logs/discuz-error_log.0 to /usr/local/apache2/logs/discuz-error_log.1 (rotatecount 1, logstart 1, i 0),
- old log /usr/local/apache2/logs/discuz-error_log.0 does not exist
- log /usr/local/apache2/logs/discuz-error_log.2 doesn't exist -- won't try to dispose of it
- running prerotate script
- renaming /usr/local/apache2/logs/discuz-error_log to /usr/local/apache2/logs/discuz-error_log.1
- creating new /usr/local/apache2/logs/discuz-error_log mode = 0644 uid = 0 gid = 0
- rotating pattern: /usr/local/apache2/logs/discuz-access_log forced from command line (5 rotations)
- empty log files are rotated, old logs are removed
- considering log /usr/local/apache2/logs/discuz-access_log
- log needs rotating
- rotating log /usr/local/apache2/logs/discuz-access_log, log->rotateCount is 5
- dateext suffix '-20160201'
- glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
- renaming /usr/local/apache2/logs/discuz-access_log.5 to /usr/local/apache2/logs/discuz-access_log.6 (rotatecount 5, logstart 1, i 5),
- old log /usr/local/apache2/logs/discuz-access_log.5 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.4 to /usr/local/apache2/logs/discuz-access_log.5 (rotatecount 5, logstart 1, i 4),
- old log /usr/local/apache2/logs/discuz-access_log.4 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.3 to /usr/local/apache2/logs/discuz-access_log.4 (rotatecount 5, logstart 1, i 3),
- old log /usr/local/apache2/logs/discuz-access_log.3 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.2 to /usr/local/apache2/logs/discuz-access_log.3 (rotatecount 5, logstart 1, i 2),
- old log /usr/local/apache2/logs/discuz-access_log.2 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.1 to /usr/local/apache2/logs/discuz-access_log.2 (rotatecount 5, logstart 1, i 1),
- old log /usr/local/apache2/logs/discuz-access_log.1 does not exist
- renaming /usr/local/apache2/logs/discuz-access_log.0 to /usr/local/apache2/logs/discuz-access_log.1 (rotatecount 5, logstart 1, i 0),
- old log /usr/local/apache2/logs/discuz-access_log.0 does not exist
- log /usr/local/apache2/logs/discuz-access_log.6 doesn't exist -- won't try to dispose of it
- running prerotate script
- renaming /usr/local/apache2/logs/discuz-access_log to /usr/local/apache2/logs/discuz-access_log.1
- creating new /usr/local/apache2/logs/discuz-access_log mode = 0644 uid = 0 gid = 0
- # ls /usr/local/apache2/logs/
- access_log discuz-access_log discuz-error_log.1
- default-vhost-access_log discuz-access_log.1 error_log
- default-vhost-error_log discuz-error_log httpd.pid
编辑回复