131

I have problem connecting to OpenVPN server. Where are OpenVPN log files and how do I find the connection details?

3
  • in general, you can found configuration files on /etc/openvpn/ there was contained log files and your openVPN configuration Apr 1, 2013 at 8:00
  • Here's the documentation page you need Dec 2, 2020 at 6:32
  • Are you interested in troubleshooting the client, or the server? I think it's useful to ask for both, but it's just nice to know. (I know this is an old question) Dec 18, 2023 at 8:41

6 Answers 6

117

If you are using the network manager plugin (network-manager-openvpn), look into /var/log/syslog

This should give you the last logs of openvpn:

$ grep VPN /var/log/syslog

Connection details are to be found in /etc/openvpn/

4
  • 1
    Could also be called openvpnas.log in /var/log/
    – Victor S
    Jul 12, 2018 at 19:57
  • 8
    This was good in 2014 and searches might lead to here. In 2021, many distros switched to systemd and the logs are accessible via journalctl, see askubuntu.com/questions/885383/….
    – Hermann
    Feb 8, 2021 at 9:55
  • 8
    grep vpn -i /var/log/syslog is better to use. grep is case-sensitive by default and in my case it was missing an important warning : Jan 11 22:12:06 blablabla-nix nm-openvpn[3890]: WARNING: Your certificate has expired! Jan 12, 2022 at 9:57
  • even better, use less to browse easily in your terminal: grep -i VPN /var/log/syslog | less +G Dec 3, 2023 at 23:45
54

By default, in most distros, OpenVPN log output goes to the syslog, which is usually at /var/log/syslog

However, your config files can set the logfile location explicitly, e.g.:

log-append /var/log/openvpn.log

This works for both OpenVPN clients and servers. OpenVPN config files are usually located in /etc/openvpn and usually named *.conf. server.conf is canonical; client config filenames are usually like <client name/>.conf.

31

Log file location

On servers, OpenVPN is usually run as a system service, i.e., started with the --daemon option. According to the OpenVPN man page, using the --daemon [progname] option has the following effect:

Become a daemon after all initialization functions are completed. This option will cause all message and error output to be sent to the syslog file (such as /var/log/messages), except for the output of scripts and ifconfig commands, which will go to /dev/null unless otherwise redirected. The syslog redirection occurs immediately at the point that --daemon is parsed on the command line even though the daemonization point occurs later. If one of the --log options is present, it will supercede (sic) syslog redirection.

Use either of the --log file or --log-append file options if you want OpenVPN messages to be logged to a different file. The --log option causes the specified log file to be over-written each time the OpenVPN daemon starts while the --log-append option adds new entries to the log file. These options can also be set in the OpenVPN configuration file, e.g.,

log /var/log/openvpn.log

Verbosity

The --verb option can be used to set the log file verbosity from 0 (no output except for fatal errors) to 11 (for maximum debugging information). The man page specifies levels of 1 to 4 as the appropriate range for normal usage. This behaviour can be set in the OpenVPN configuration file, e.g.,

verb 3
2
  • I changed to verb 2 from the default 3, but there was no noticeable difference. I then rm openvpn.log thinking of restarting a fresh log. But openvpn.log didn't get created and I now can't find the logs. Where has the log gone to now? I created a new openvpn.log but it remained at size 0.
    – Old Geezer
    Aug 20, 2019 at 4:03
  • @OldGeezer That would best be asked as a new question where you can provide specific details about the configuration of your OpenVPN and OS logging (systemd/syslog) configuration. Aug 20, 2019 at 11:25
3

Use the -l or --syslog argument calling openconnect. Now you can check with tail -f /var/log/syslog

2

For people from 2023 who googled this, here is how you can view OpenVPN logs in modern Ubuntu with systemd via journalctl:

sudo journalctl -u [email protected]

Then by pressing Shift + G you can scroll down to the most recent lines.

You can also activate follow mode by specifying -f to automatically scroll down as new entries come:

sudo journalctl -u [email protected] -f
1
  • 1
    I can confirm from 2024. Also -e makes it more comfortable
    – Alexey Sh.
    Feb 9 at 22:31
1

It is supposed to be in your home directory (home directory of the user whom executing it), eg ~. Running an ls -l command will perhaps reveal it. On the other hand, you may start openvpn with --debug option to capture what's happening realtime on the terminal.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .