You are not logged in.

#1 2018-05-23 09:26:00

UglyBob
Member
Registered: 2015-11-29
Posts: 54

No hostname from systemd-journal-remote

I have setup a small yocto system to stream its journal logs using systemd-journal-upload and systemd-journal-remote (on my arch machine). I have set it up to split on host, as I will need to remote journal several systems later. But the log files gets named by the remote ip, not the hostname (which is a problem for me when they use dynamic IP):

$ ls /var/log/journal/remote/
remote-172.30.112.177.journal                                     remote-172.30.112.196.journal
remote-172.30.112.182@00056c524c1229f9-92250640b8b48c35.journal~  remote-172.30.112.56.journal
remote-172.30.112.182.journal
$ cat /etc/systemd/journal-remote.conf 
[Remote]
# Seal=false
SplitMode=host
# ServerKeyFile=/etc/ssl/private/journal-remote.pem
# ServerCertificateFile=/etc/ssl/certs/journal-remote.pem
# TrustedCertificateFile=/etc/ssl/ca/trusted.pem
# cat /etc/systemd/journal-upload.conf 
[Upload]
URL=http://172.30.112.44:19532
# cat /etc/systemd/system/systemd-journal-upload.service 
[Unit]
Description=Journal Remote Upload Service
Documentation=man:systemd-journal-upload(8)
After=network.target

[Service]
ExecStart=/lib/systemd/systemd-journal-upload --save-state
User=systemd-journal-upload
SupplementaryGroups=systemd-journal
PrivateTmp=yes
PrivateDevices=yes
WatchdogSec=3min

# Add reset/restart options
TimeoutSec=120
Restart=on-failure
RestartSec=2

# Add accounting options
CPUAccounting=true
BlockIOAccounting=true
MemoryAccounting=false
TasksAccounting=true

# If there are many splits up journal files we need a lot of file descriptors to access them all and combine

LimitNOFILE=16384

[Install]
WantedBy=multi-user.target
$ cat /etc/systemd/system/systemd-journal-remote.service 
[Unit]
Description=Journal Remote Sink Service
Documentation=man:systemd-journal-remote(8) man:journal-remote.conf(5)
Requires=systemd-journal-remote.socket

[Service]
ExecStart=/lib/systemd/systemd-journal-remote --listen-http=-3 --output=/var/log/journal/remote/
User=systemd-journal-remote
Group=systemd-journal-remote
PrivateTmp=yes
PrivateDevices=yes
PrivateNetwork=yes
WatchdogSec=3min

[Install]
Also=systemd-journal-remote.socket

Offline

#2 2018-05-23 20:30:42

loqs
Member
Registered: 2014-03-06
Posts: 17,378

Re: No hostname from systemd-journal-remote

Hostname seems to be set here https://github.com/systemd/systemd/blob … ote.c#L603 or here https://github.com/systemd/systemd/blob … ote.c#L907
which is defined https://github.com/systemd/systemd/blob … til.c#L685 which for AF_INET calls
https://github.com/systemd/systemd/blob … til.c#L564 which will only return an IPV4 or IPV6 address not a hostname.

Offline

Board footer

Powered by FluxBB