systemd / systemd-netlogd

Forwards messages from the journal to other hosts over the network using syslog format RFC 5424 and RFC 3164
GNU General Public License v2.0
69 stars 25 forks source link

DNS not supported #110

Closed anttiryt closed 2 months ago

anttiryt commented 3 months ago

Seems using DNS in the Address line is not supported

[Network]
Address=syslog.company.fi:514
#Protocol=udp
LogFormat=rfc3339
sudo systemctl status systemd-netlogd
● systemd-netlogd.service - Journal Syslog Unicast and Multicast Daemon
     Loaded: loaded (/lib/systemd/system/systemd-netlogd.service; disabled; preset: enabled)
     Active: active (running) since Fri 2024-06-14 19:59:53 EEST; 2s ago
       Docs: man:systemd-netlogd(8)
   Main PID: 1951 (systemd-netlogd)
     Status: "Idle."
      Tasks: 1 (limit: 4915)
        CPU: 136ms
     CGroup: /system.slice/systemd-netlogd.service
             └─1951 /usr/lib/systemd/systemd-netlogd

Jun 14 19:59:53 tscinst systemd-netlogd[1951]: Failed to create network socket: Address family not supported by protocol
Jun 14 19:59:53 tscinst systemd-netlogd[1951]: Failed to create network socket: Address family not supported by protocol
Jun 14 19:59:53 tscinst systemd-netlogd[1951]: Failed to create network socket: Address family not supported by protocol
Jun 14 19:59:53 tscinst systemd-netlogd[1951]: Failed to create network socket: Address family not supported by protocol
ssahani commented 3 months ago

Please test with https://github.com/systemd/systemd-netlogd/pull/111

 sudo SYSTEMD_LOG_LEVEL=debug build/systemd-netlogd
Remote server='google.com' port: '6000'...
Resolving google.com...
varlink: Setting state idle-client
systemd-netlogd running as pid 107267
varlink: Sending message: {"method":"io.systemd.Resolve.ResolveHostname","parameters":{"name":"google.com","flags":0}}
varlink: Changing state idle-client → calling
varlink: Received message: {"parameters":{"addresses":[{"ifindex":2,"family":10,"address":[36,4,104,0,64,7,8,27,0,0,0,0,0,0,32,14]},{"ifindex":2,"family":2,"address":[142,250,182,78]}],"name":"google.com","flags":8388609}}
varlink: Changing state calling → called
varlink: Changing state called → idle-client
Resolve : Success
Resolved address 142.250.182.78:6000 for .
Resolved address [2404:6800:4007:81b::200e]:6000 for .
Disconnecting network ...
Connecting network ...
Successfully created socket with fd='10'
Connecting to remote server: '[2404:6800:4007:81b::200e]:6000'
Connected to remote server: '[2404:6800:4007:81b::200e]:6000'
Last cursor was not available.
Reading from journal cursor=s=e2f5f1b344b9479e818af3665afb404c;i=7e1;b=e5735408cf3e4889b964e2a47ada960a;m=1dee99;t=6196242e8cb3f;x=1c32c9205bea604d
Received from journal MESSAGE='Linux version 6.8.5-301.fc40.x86_64 (mockbuild@0bc0cc78c12e4762acf61c209bd02e96) (gcc (GCC) 14.0.1 20240328 (Red Hat 14.0.1-0), GNU ld version 2.41-34.fc40) #1 SMP PREEMPT_DYNAMIC Thu Apr 11 20:00:10 UTC 2024'
Successful sendmsg: 266 bytes
Reading from journal cursor=s=e2f5f1b344b9479e818af3665afb404c;i=7e2;b=e5735408cf3e4889b964e2a47ada960a;m=1deeaa;t=6196242e8cb50;x=a1528833a88050dd
Received from journal MESSAGE='Command line: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-6.8.5-301.fc40.x86_64 root=UUID=6db3eafd-c50d-4144-b185-4a6398c659ad ro rootflags=subvol=root rhgb quiet'
Successful sendmsg: 206 bytes
Reading from journal cursor=s=e2f5f1b344b9479e818af3665afb404c;i=7e3;b=e5735408cf3e4889b964e2a47ada960a;m=1deeb1;t=6196242e8cb57;x=bfdbf5e146d14cd1
Received from journal MESSAGE='Disabled fast string operations'