OpenVPN / openvpn

OpenVPN is an open source VPN daemon
http://openvpn.net
Other
10.26k stars 2.92k forks source link

Include severity in log lines #490

Open StyXman opened 5 months ago

StyXman commented 5 months ago

Describe the bug

This is a wish. When writing logs, please include severity.

To Reproduce

mdione@lugburz:~$ sudo openvpn AWS-OVH-client.conf
2024-01-27 11:24:16 DEPRECATED OPTION: The option --secret is deprecated.
2024-01-27 11:24:16 DEPRECATION: No tls-client or tls-server option in configuration detected. OpenVPN 2.7 will remove the functionality to run a VPN without TLS. See the examples section in the manual page for examples of a similar quick setup with peer-fingerprint.
2024-01-27 11:24:16 OpenVPN 2.6.3 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] [DCO]
2024-01-27 11:24:16 library versions: OpenSSL 3.0.11 19 Sep 2023, LZO 2.10
2024-01-27 11:24:16 DCO version: N/A
2024-01-27 11:24:16 Cipher BF-CBC not supported
2024-01-27 11:24:16 Exiting due to fatal error

Expected behavior I can't tell which is the error. The first two lines are probably warnings, then a couple of info lines, then an error, then either info or error.

Version information (please complete the following information):

selvanair commented 4 months ago

Log sent to syslog has some error-level information (ERROR, WARNING, NOTICE). The management also gets flags indicating the error type. Including it in the console/file log as well looks useful.

schwabe commented 4 months ago

We also have an option to enable better parsable log output

selvanair commented 4 months ago

We also have an option to enable better parsable log output

Unforunately --machine-readable-output prints flags as a number (hex) that makes sense only internally to OpenVPN (like M_ERRNO|M_NONFATAL = 120 in hex).

That said, parsing only the ~first~ high nibble of the last byte of flags may be enough for most users, so documenting that could be a way to go.