Skip to contentSkip to conversation

More specific syslog process name with systemd

PATCH In review François Kooman 3 participants 4 messages Aug 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 More specific syslog process name with systemd

Adds the --syslog option to specify the unit and configuration name when using systemd.

---
 distro/systemd/[email protected]... | 2 +-
 distro/systemd/[email protected]... | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
distro/systemd/[email protected]... +1 -1
index cbcef653..266d9f9c 100644
@@ -10,7 +10,7 @@ Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
 Type=notify
 PrivateTmp=true
 WorkingDirectory=/etc/openvpn/client
-ExecStart=@sbindir@/openvpn --suppress-timestamps --nobind --config %i.conf
+ExecStart=@sbindir@/openvpn --syslog %p@%i --suppress-timestamps --nobind --config %i.conf
 CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE
 LimitNPROC=10
 DeviceAllow=/dev/null rw
distro/systemd/[email protected]... +1 -1
index d1cc72cb..be086b79 100644
@@ -10,7 +10,7 @@ Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
 Type=notify
 PrivateTmp=true
 WorkingDirectory=/etc/openvpn/server
-ExecStart=@sbindir@/openvpn --status %t/openvpn-server/status-%i.log --status-version 2 --suppress-timestamps --config %i.conf
+ExecStart=@sbindir@/openvpn --syslog %p@%i --status %t/openvpn-server/status-%i.log --status-version 2 --suppress-timestamps --config %i.conf
 CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE CAP_AUDIT_WRITE
 LimitNPROC=10
 DeviceAllow=/dev/null rw
Signature · 1 line
2.21.0
#1 lore raw
Quoted 2 lines · François Kooman

Adds the --syslog option to specify the unit and configuration name when using systemd.

Could you please provide a rationale to why this is needed? How things works now, is that the systemd-journal picks up everything; including various additional meta-data which syslog does not support.

Now you get the log data with: journalctl -u openvpn-{client,server}@CONFIG} And this also provides filtering possibilities as well, like '-b' (only log entries since last boot) or '--since yesterday'.

If you want logged data to syslog, have a look at the journal integration rsyslog provides - which can also include the additional meta-data:
<https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/s1-interaction_of_rsyslog_and_journal>

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#2 lore raw
Quoted 3 lines · David Sommerseth

Could you please provide a rationale to why this is needed? How things works now, is that the systemd-journal picks up everything; including various additional meta-data which syslog does not support.

The rationale was that when viewing the log with journalctl you only see the syslog identifier, i.e. "openvpn" and not the full unit name.

Quoted 3 lines

Now you get the log data with: journalctl -u openvpn-{client,server}@CONFIG} And this also provides filtering possibilities as well, like '-b' (only log entries since last boot) or '--since yesterday'.

That's much better actually, there's also the journalctl -o verbose that shows the _SYSTEMD_UNIT.

Thanks!

Please ignore the patch!

Cheers,
François

#3 lore raw

Hi,

Quoted 1 line · François Kooman

Please ignore the patch!

Argueing patches away is so much easier than ACKing :-))

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...