zuntan02のはてなブログ

備忘録的なものです。時々職場の技術者ブログにも転記してますが、メインはこちらで。

(AmazonLinux2)syslogが出力されていない

【概要】

AmazonLinux2サーバでsyslogが0byteのままになってた

-rw-------   1 root   root                 0 Nov 11 17:39 cron
-rw-------   1 root   root                 0 Oct 10 03:32 cron-20211017
-rw-------   1 root   root                 0 Oct 17 03:19 cron-20211024
-rw-------   1 root   root                 0 Oct 24 03:23 cron-20211031
-rw-------   1 root   root                 0 Oct 31 03:11 cron-20211107
-rw-------   1 root   root                 0 Nov  7 03:48 maillog
-rw-------   1 root   root                 0 Oct 10 03:32 maillog-20211017
-rw-------   1 root   root                 0 Oct 17 03:19 maillog-20211024
-rw-------   1 root   root                 0 Oct 24 03:23 maillog-20211031
-rw-------   1 root   root                 0 Oct 31 03:11 maillog-20211107
-rw-------   1 root   root                 0 Nov  7 03:48 messages
-rw-------   1 root   root                 0 Oct 10 03:32 messages-20211017
-rw-------   1 root   root                 0 Oct 17 03:19 messages-20211024
-rw-------   1 root   root                 0 Oct 24 03:23 messages-20211031
-rw-------   1 root   root                 0 Oct 31 03:11 messages-20211107
-rw-------   1 root   root                 0 Nov  7 03:48 secure
-rw-------   1 root   root                 0 Oct 10 03:32 secure-20211017
-rw-------   1 root   root                 0 Oct 17 03:19 secure-20211024
-rw-------   1 root   root                 0 Oct 24 03:23 secure-20211031
-rw-------   1 root   root                 0 Oct 31 03:11 secure-20211107

【解決】

qiita.com

こちらによれば
[systemd-journald]→[rsyslogd]→ログファイル、という流れ

プロセス確認

root     12847  0.0  0.0  39304  3140 ?        Ss   17:34   0:00 /usr/lib/systemd/systemd-journald
root     26999  0.0  0.1 303100  7856 ?        Ssl  13:34   0:00 /usr/sbin/rsyslogd -n

となっていればよいが、今回の環境ではsystemd-journaldが落ちていたため、起動

systemctl restart systemd-journald

これでログ出るようになった。
しょうもないことですがしょうもないがゆえに情報がなく結構手間取ったので自分のためにメモ。