CentOS6.10でlogrotateが手動コマンドでは正常に動作しますが、自動では動作しません。
何か設定があるのかもしれませんので、ご教授をお願いします。
********************** 状況は以下の通りです。 **********************
以下のコマンドを実行すると、正常にログローテーションが実施されます。
sudo /usr/sbin/logrotate /etc/logrotate.conf
また、以下のコマンドでは以下のように出力され特に問題なさそうです。
logrotate -dv /etc/logrotate.conf
reading config file /etc/logrotate.conf including /etc/logrotate.d reading config file ConsoleKit reading config info for /var/log/ConsoleKit/history reading config file dracut reading config info for /var/log/dracut.log reading config file fail2ban reading config info for /var/log/fail2ban.log reading config file httpd reading config info for /var/log/httpd/*log reading config file mysql reading config info for /var/lib/mysql/mysqld.log reading config file psacct reading config info for /var/account/pacct reading config file syslog reading config info for /var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler reading config file yum reading config info for /var/log/yum.log reading config info for /var/log/wtmp reading config info for /var/log/btmp Handling 10 logs rotating pattern: /var/log/ConsoleKit/history monthly (6 rotations) empty log files are not rotated, old logs are removed considering log /var/log/ConsoleKit/history log does not need rotating rotating pattern: /var/log/dracut.log 1048576 bytes (7 rotations) empty log files are not rotated, old logs are removed considering log /var/log/dracut.log log does not need rotating rotating pattern: /var/log/fail2ban.log after 1 days (7 rotations) empty log files are not rotated, old logs are removed considering log /var/log/fail2ban.log log does not need rotating not running postrotate script, since no logs were rotated rotating pattern: /var/log/httpd/*log after 1 days (7 rotations) empty log files are not rotated, old logs are removed not running postrotate script, since no logs were rotated rotating pattern: /var/lib/mysql/mysqld.log after 1 days (3 rotations) empty log files are not rotated, old logs are removed considering log /var/lib/mysql/mysqld.log log /var/lib/mysql/mysqld.log does not exist -- skipping not running postrotate script, since no logs were rotated rotating pattern: /var/account/pacct after 1 days (31 rotations) empty log files are not rotated, old logs are removed considering log /var/account/pacct log does not need rotating not running postrotate script, since no logs were rotated rotating pattern: /var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler after 1 days (3 rotations) empty log files are rotated, old logs are removed considering log /var/log/cron log does not need rotating considering log /var/log/maillog log does not need rotating considering log /var/log/messages log does not need rotating considering log /var/log/secure log does not need rotating considering log /var/log/spooler log does not need rotating not running postrotate script, since no logs were rotated rotating pattern: /var/log/yum.log yearly (7 rotations) empty log files are not rotated, old logs are removed considering log /var/log/yum.log log does not need rotating rotating pattern: /var/log/wtmp after 1 days (1 rotations) empty log files are rotated, only log files >= 1048576 bytes are rotated, old logs are removed considering log /var/log/wtmp log does not need rotating rotating pattern: /var/log/btmp after 1 days (1 rotations) empty log files are rotated, old logs are removed considering log /var/log/btmp log does not need rotating
「動作しない」とは?
エラーメッセージが出ていますか?
いえ、特に何も出ていないように見えます。
/var/log/messages
あたりを確認しています。
それでは、そもそも起動がされていないのでは?
なるほど、logrotateの起動はどうやって実施するのですか?
crontabからです。普通は設定されているはずですが。
/etc/cron.daily/logrotate
というファイルがありませんか?
あります。以下のようになっています。
見て目は問題なさそう???
--------------------------
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
--------------------------
crondが動いてないとか?
service crond status
crond: 認識されていないサービスです。
となりますので、そのようです。
crondが起動していないとかあるんですね。
あとは何とかしてみます。
crondの起動設定のURLか何かあれば連絡頂けると助かります!
ありがとうございましたm(_ _)m
sudo yum -y install cronie-noanacron
sudo service crond start
で普通にインストールできましたので、回復しそうです。
回答1件
あなたの回答
tips
プレビュー