質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
logrotate

logrotateはログの世代管理やサイズ制限を行うLinux標準のツールです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Q&A

解決済

1回答

1783閲覧

CentOS6でlogrotateが動作しない

yamayamak

総合スコア131

logrotate

logrotateはログの世代管理やサイズ制限を行うLinux標準のツールです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

0グッド

0クリップ

投稿2019/08/06 12:36

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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

otn

2019/08/06 12:49

「動作しない」とは? エラーメッセージが出ていますか?
yamayamak

2019/08/06 12:51

いえ、特に何も出ていないように見えます。 /var/log/messages あたりを確認しています。
otn

2019/08/06 12:54 編集

それでは、そもそも起動がされていないのでは?
yamayamak

2019/08/06 12:55

なるほど、logrotateの起動はどうやって実施するのですか?
otn

2019/08/06 12:59

crontabからです。普通は設定されているはずですが。 /etc/cron.daily/logrotate というファイルがありませんか?
yamayamak

2019/08/06 13:01

あります。以下のようになっています。 見て目は問題なさそう??? -------------------------- #!/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 --------------------------
otn

2019/08/06 13:04

crondが動いてないとか? service crond status
yamayamak

2019/08/06 13:09

crond: 認識されていないサービスです。 となりますので、そのようです。 crondが起動していないとかあるんですね。 あとは何とかしてみます。 crondの起動設定のURLか何かあれば連絡頂けると助かります!
yamayamak

2019/08/06 13:21

ありがとうございましたm(_ _)m sudo yum -y install cronie-noanacron sudo service crond start で普通にインストールできましたので、回復しそうです。
guest

回答1

0

自己解決

教えてもらいましたが、crondが起動(インストールされて)していないためにlogrotateが動いてませんでした。

sudo yum -y install cronie-noanacron sudo service crond start

で回復しそうです。

投稿2019/08/06 13:23

yamayamak

総合スコア131

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問