I do have one log server which runs systemd journal remote software to receive journal entries from remote hosts via systemd journal upload. This works fine. The only trouble that I have is that the journal names in /var/log/journal/remote
are named with the IP address instead of the hostname.
The documentation says:
"[...] Files will be called remote-hostname.journal, where the hostname part is the escaped hostname of the source endpoint of the connection, or the numerical address if the hostname cannot be determined."
So in my case it obviously can not be determined.
I have configured the clients ip - host map in the /etc/hosts
file on the log server. A nslookup <hostname>
resolves the ip address correctly. A comment here tells that the host file is not respected in the process of determining the hostname.
So how do I configure my server to make systemd journal remote pick up the hostname and use it as filename instead of the ip address?
Entry in /etc/hosts
10.0.0.2 web-01
To debug name <--> ip resolution the following commands were run:
Name to ip:
❯ getent ahosts web-01
10.0.0.2 STREAM web-01
10.0.0.2 DGRAM
10.0.0.2 RAW
IP to name:
❯ getent ahosts 10.0.0.2
10.0.0.2 STREAM 10.0.0.2
10.0.0.2 DGRAM
10.0.0.2 RAW
❯ getent hosts 10.0.0.2
10.0.0.2 web-01
❯ nslookup 10.0.0.2
2.0.0.10.in-addr.arpa name = web-01.