systemd-journal-remote는 로그 파일이 손상되었다고 주장합니다.

systemd-journal-remote는 로그 파일이 손상되었다고 주장합니다.

서버에서 중앙 서버로 로그를 업로드하려고 합니다. 이를 위해 systemd-journal-remote 및 systemd-journal-upload를 사용합니다. 기존 로그의 초기 동기화가 원활하게 진행되었습니다. 잠시 후 새 저널이 업로드되면 systemd-journal-remote는 저널이 손상되었다고 주장하기 시작합니다.

# journalctl -u systemd-journal-remote
Dec 07 11:59:41 syslog systemd-journal-remote[1459]: /var/log/journal/remote//remote-192.168.100.85.journal: Journal header limits reached or header out-of-date, rotating
Dec 07 11:59:44 syslog systemd-journal-remote[1459]: /var/log/journal/remote//remote-192.168.100.85.journal: Journal header limits reached or header out-of-date, rotating
Dec 07 13:25:55 syslog systemd-journal-remote[1459]: File /var/log/journal/remote//remote-192.168.100.85.journal corrupted or uncleanly shut down, renaming and replacing.
Dec 07 14:14:04 syslog systemd-journal-remote[1459]: File /var/log/journal/remote//remote-192.168.100.85.journal corrupted or uncleanly shut down, renaming and replacing.
Dec 07 22:06:10 syslog systemd-journal-remote[1459]: File /var/log/journal/remote//remote-192.168.100.85.journal corrupted or uncleanly shut down, renaming and replacing.
Dec 08 07:14:29 syslog systemd-journal-remote[1459]: File /var/log/journal/remote//remote-192.168.100.85.journal corrupted or uncleanly shut down, renaming and replacing.

현재 파일을 저널~ 파일로 이동합니다.

# ls -l /var/log/journal/remote
-rw-r----- 1 systemd-journal-remote systemd-journal-remote   8388608 Dec  8 09:08 remote-192.168.100.85.journal
-rw-r----- 1 systemd-journal-remote systemd-journal-remote  83886080 Dec  7 13:25 [email protected]~
-rw-r----- 1 systemd-journal-remote systemd-journal-remote   8388608 Dec  7 14:14 [email protected]~
-rw-r----- 1 systemd-journal-remote systemd-journal-remote   8388608 Dec  7 22:06 [email protected]~
-rw-r----- 1 systemd-journal-remote systemd-journal-remote   8388608 Dec  8 07:14 [email protected]~
-rw-r----- 1 systemd-journal-remote systemd-journal-remote  75497472 Dec  7 11:59 remote-192.168.100.85@20cd77d5c97e47119c33de6c4ca2c0d2-0000000000000001-0005c3d7d8a4d2a4.journal

이상하게도 이러한 파일은 Journalctl로 완전히 읽을 수 있으며 확인 결과 PASS가 반환됩니다.

# journalctl --file="/var/log/journal/remote/*.journal~" --verify
PASS: /var/log/journal/remote/[email protected]~                                                            
PASS: /var/log/journal/remote/[email protected]~                                                            
PASS: /var/log/journal/remote/[email protected]~                                                            
PASS: /var/log/journal/remote/[email protected]~ 

systemd-journal-upload 서버에는 아무것도 기록되지 않습니다.

원본 서버와 대상 서버 모두 systemd 버전 245의 Ubuntu 20.04(Focal) 서버를 실행하고 있습니다. 전송으로 http와 https를 사용해 보았습니다. 또한 systemd-journal-remote 서버를 Ubuntu 22.04(Jammy)(systemd 249)로 업그레이드해 보았습니다. 이들 모두 동일한 동작을 초래합니다.

왜 이런 일을 하는가? 로그 파일은 항상 8MB 이상이지만 로그 줄이 2개만 포함되는 경우도 있기 때문에 이렇게 하면 디스크 공간이 꽉 차게 됩니다.

관련 정보