0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Linux] システムログ設定_systemd-journald, /var/log/journal, /run/log/journal

Posted at

systemd-journald

項目 内容
役割 systemd-journald は systemd 環境における ログの一元管理 を担うデーモン
ログの対象 - systemd によって起動されたプロセスの 標準出力 / 標準エラー出力
- syslog メッセージなども受信可能
ログの形式 バイナリ形式(テキストではない)で保存され、journalctl コマンドで閲覧
ファシリティ / プライオリティ対応 syslog と同様に、ファシリティ(送信元分類)プライオリティ(重要度) に対応

ログの保存先と永続化の設定

保存先 特徴
/var/log/journal - 永続ログ保存先
- 永続化には設定ファイルでの指定が必要
/run/log/journal - 一時ログ保存先(デフォルト
- RAM上の tmpfs に配置され、再起動で消去される

永続化設定手順(再起動後もログを保持したい場合)

  1. /var/log/journal ディレクトリを作成(root権限)

    sudo mkdir -p /var/log/journal
    sudo systemd-tmpfiles --create --prefix /var/log/journal
    
  2. /etc/systemd/journald.conf を編集し、以下を設定:

    Storage=persistent
    
  3. systemd-journald を再起動:

    sudo systemctl restart systemd-journald
    

Ping-t

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?