logrotateのmaxageオプションが期待どおりに機能しません。

logrotateのmaxageオプションが期待どおりに機能しません。

以下を使用してログを回転しています。ログの回転Linuxで。以下より古いものを削除したいと思います。7空。だから私は努力しました最大年齢オプションからログの回転しかし、期待どおりに動作しません。

6つのログがあるとし、次の順序で生成されます。

Date            filename

18th oct    sample.log.2017-10-18
17th oct    sample.log.2017-10-17
16th oct    sample.log.2017-10-16
15th oct    sample.log.2017-10-15
14th oct    sample.log.2017-10-14
13th oct    sample.log.2017-10-13
12th oct    sample.log.2017-10-12

今日(10月19日) サンプルログが生成されないため、ログは循環しません。サンプルログ2017-10-12削除する必要がありますが、なぜ削除されないのですか?

次の logrotate 属性ファイルを探します。

/var/log/test/*.log {

    missingok
    notifempty
    nocompress
    daily
    dateext
    dateformat .%Y-%m-%d
    maxage 7

}

ベストアンサー1

glob パターンが不完全です。.logすべて7日後に削除されるログのみが一致します.log.[0-9-]*

おすすめ記事