openvpn icon indicating copy to clipboard operation
openvpn copied to clipboard

Include severity in log lines

Open StyXman opened this issue 1 year ago • 3 comments

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):

  • OS: Debian bookworm/stable
  • OpenVPN version: 2.6.3

StyXman avatar Jan 27 '24 12:01 StyXman

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.

selvanair avatar Feb 10 '24 18:02 selvanair

We also have an option to enable better parsable log output

schwabe avatar Feb 11 '24 00:02 schwabe

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.

selvanair avatar Feb 15 '24 18:02 selvanair