ジャーナルを使用してジャーナルの有効期限を強制する方法は?

ジャーナルを使用してジャーナルの有効期限を強制する方法は?

過去10日間のログだけを保存したいとしましょう。

私は走らなければなりませんか?

journalctl --vacuum-time=10d

毎日のタイマーはありますか?それでも使用する必要がありますか--rotate? 「ログファイルの循環」とはどういう意味ですか?

何かを設定できますか/etc/systemd/journald.conf?読み込んでいるが時間ではないバイトだけを許可しているman 5 journald.confようです。SystemMaxUse

ファイルのサイズや数には興味がありません。ログを記録するのにちょうど良い時間です。

ベストアンサー1

が利用可能でなければなりません--vacuum-time。以下に示すタスクは、現在アクティブなログファイルをアーカイブに循環し、すべてのログをクリーンアップしてそのログを10日間のみ保持します。

journalctl --rotate --vacuum-time=10days    

マニュアルページから直接:

--vacuum-size=, --vacuum-time= and --vacuum-files= may be combined
       in a single invocation to enforce any combination of a size, a time
       and a number of files limit on the archived journal files.
       Specifying any of these three parameters as zero is equivalent to
       not enforcing the specific limit, and is thus redundant.

       These three switches may also be combined with --rotate into one
       command. If so, all active files are rotated first, and the
       requested vacuuming operation is executed right after. The rotation
       has the effect that all currently active files are archived (and
       potentially new, empty journal files opened as replacement), and
       hence the vacuuming operation has the greatest effect as it can
       take all log data written so far into account.

おすすめ記事