shervinsahba / polybar-vpn-controller

Polybar module for VPN control. Set up for Mullvad VPN but modifiable for others.
MIT License
58 stars 12 forks source link

journalctl receives excessive messages from vpn #6

Closed shervinsahba closed 3 years ago

shervinsahba commented 3 years ago

Since the script calls mullvad status intermittently, journalctl ends up flooded with these requests. This leads to excessive journal size. The major issue I foresee is if the user has a small max journal size set: then mullvad (and perhaps other vpn) entries would dominate the space. This could make debugging computers with a small max journal size tricky. (Running on 5.4.1-MANJARO.)

Does anyone know a good way to silence these journal outputs - preferably without silencing other mullvad journal outputs?

2020-08-03T05:51:06-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:11-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:11-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:16-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:16-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:21-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:21-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:26-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:26-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:31-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:31-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:36-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:36-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:41-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
2020-08-03T05:51:41-0700 fractal mullvad-daemon[870]: [mullvad_daemon::management_interface][DEBUG] get_state
jamc-code commented 3 years ago

Ooooooh, this is interesting. It looks like journald is going to be controlling what gets logged, which includes frequency of logging. You can adjust /etc/systemd/journald.conf manually to reduce the frequency allowed by any program, and probably edit mullvad's systemd service as well, but those aren't very user friendly. For now, maybe add something be added to the README giving people a heads up as to journals filling up.

jamc-code commented 3 years ago

Looking into it further, a quick fix would be editing your mullvad service (assuming it's being used) at /usr/lib/systemd/system/mullvad-daemon.service to execute the daemon with the --disable-log-to-file flag. If you want to check out the daemon itself it's located at /opt/Mullvad\ VPN/resources/mullvad-daemon.

EDIT: I can't test this to verify that it works but it should

shervinsahba commented 3 years ago

Nice find! Yep it works!

Apparently the mullvad repo from the Arch User Repo comes set with debug mode -v on, so either disabling logs entirely or removing the debug flag seems good. Yeah, good suggestion - I'll make a note of that on the README.

# Systemd service unit file for the Mullvad VPN daemon

[Unit]
Description=Mullvad VPN daemon
Wants=network.target
After=network-online.target
After=NetworkManager.service
After=systemd-resolved.service
StartLimitBurst=5
StartLimitIntervalSec=20

[Service]
Restart=always
RestartSec=1
#ExecStart=/opt/Mullvad\x20VPN/resources/mullvad-daemon -v --disable-stdout-timestamps
#ExecStart=/opt/Mullvad\x20VPN/resources/mullvad-daemon --disable-stdout-timestamps --disable-log-to-file
ExecStart=/opt/Mullvad\x20VPN/resources/mullvad-daemon --disable-stdout-timestamps

[Install]
WantedBy=multi-user.target

Follow up with systemctl daemon-reload and systemctl restart mullvad-daemon.