{{tag>gentoo linux}} # rsyslog が udp を受信しなくなった その2 よくよく調べたら、rsyslog のバージョン上げてない他の rsyslog でも現象が発生してました……はて? ## もうちょっと考えてみる ん~……。 ``` # ss -ua | grep -e 'syslog' -e 'State' State Recv-Q Send-Q Local Address:Port Peer Address:Port UNCONN 768 0 ip.addr.other.host:syslog *:* ``` udp の 514 でデータは受けている。ただ、それを rsyslogd が受けられていない。色々やってみると、どうもこの現象はサーバー再起動直後に発生するようで、rsyslog を落とし上げしてあげれば解消することが判明。 ``` # systemctl restart rsyslog ``` 再起動後だけ……って、をや? ``` # systemctl edit --full rsyslog ``` ``` [Unit] Description=System Logging Service Requires=syslog.socket Documentation=man:rsyslogd(8) Documentation=http://www.rsyslog.com/doc/ [Service] Type=notify ExecStart=/usr/sbin/rsyslogd -n StandardOutput=null Restart=on-failure [Install] WantedBy=multi-user.target Alias=syslog.service ``` ふむ……これもしかして rsyslog が起動した時点で、まだネットワークが有効になってないからバインドできてないんじゃ? ``` Apr 05 20:00:28 svr liblogging-stdlog[202]: [origin software="rsyslogd" swVersion="8.24.0" x-pid="202" x-info="http://www.rsyslog.com"] start Apr 05 20:00:28 svr liblogging-stdlog[202]: bound address ip.addr.of.other IP free [v8.24.0 try http://www.rsyslog.com/e/2186 ] Apr 05 20:00:28 svr liblogging-stdlog[202]: No UDP listen socket could successfully be initialized, message reception via UDP disabled. [v8.24.0] Apr 05 20:00:28 svr liblogging-stdlog[202]: imudp: no listeners could be started, input not activated. [v8.24.0] Apr 05 20:00:28 svr liblogging-stdlog[202]: activation of module imudp failed [v8.24.0 try http://www.rsyslog.com/e/-3 ] ``` あ、はい。ブート時にちゃんと怒ってました……。 ## 状況がわかったので対策してみる ん~うちの環境の rsyslogd は、純粋に syslog 転送のためだけに存在してるから、こんなんでいいかな。 ``` # systemctl edit rsyslog ``` で、こんな感じでオーバーライドします。 ``` [Unit] After=network.target ``` で、再起動。 ``` # systemctl reboot ``` openRC の場合はこんな変更……でいいんだろうか。 /etc/conf.d/rsyslog とかでなんとかできないものか……ちょっと知識不足。 --- /before/rsyslog 2017-04-05 20:59:51.960708466 +0900 +++ /etc/init.d/rsyslog 2017-04-05 21:00:00.105593209 +0900 @@ -26,7 +26,7 @@ description_configtest="Run rsyslogd's i description_rotate="Sends rsyslogd a signal to re-open its log files." depend() { - need clock hostname localmount + need clock hostname localmount net provide logger } ## 結果 うまくいきました。そういうことかぁ……。