Greener logging

Hi

I would like to have a lighter syncthing log with only errors or worse. Mine in a raspberry is started by systemd but journalctl -fu syncthing@myuser.service is verbose although with sudo systemctl edit syncthing@myuser.service I have this file generated as /etc/systemd/system/syncthing@myuser.service.d/override.conf

#Environment="STLOGSYSTEMD=true"
#Environment="STLOGLEVEL=ERROR"
ExecStart=
ExecStart=/usr/bin/syncthing serve --no-brother --no-restart --log-level=ERROR
janv. 29 22:03:54 MyPi syncthing[10756]: Failed to acquire open port (mapping="[::]:32571/TCP" id=NAT-PMP@192.168.1.254 error="getting new lease on NAT-PMP@192.168.1.254 (external port 27822 -> internal port 32571): read udp 192.168.1.139:56373->192.168.1.254:5351: recvfrom: connection refused" log.pkg=nat)
janv. 29 22:03:54 MyPi syncthing[10756]: Detected NAT services (count=1 log.pkg=nat)
janv. 29 22:03:56 MyPi syncthing[10756]: Established secure connection (device=LFA5G4N connection.local="[2a01:e0a:reda:cted:dea6:32ff:fe18:c2b5]:49126" connection.remote="[2a01:e0a:d81:9470:7f0a:1e15:bed7:8511]:22190" connection.type=tcp-client connection.lan=true connection.crypto=TLS1.3-TLS_CHACHA20_POLY1305_SHA256 connection.prio=10 connection.id=64F9U5FD9F6MGBSOUV7HI14KO4 log.pkg=connections)
janv. 29 22:03:56 MyPi syncthing[10756]: Additional device connection (device=LFA5G4N address="[2a01:e0a:reda:cted:7f0a:1e15:bed7:8511]:22190" count=5 log.pkg=model)
janv. 29 22:03:56 MyPi syncthing[10756]: Established secure connection (device=7724VXB connection.local=192.168.1.139:46366 connection.remote=192.168.1.29:22290 connection.type=tcp-client connection.lan=true connection.crypto=TLS1.3-TLS_CHACHA20_POLY1305_SHA256 connection.prio=10 connection.id=REDACTEDREDACTEDREDACTED log.pkg=connections)
janv. 29 22:03:56 MyPi syncthing[10756]: Additional device connection (device=7724VXB address=192.168.1.29:22290 count=5 log.pkg=model)
janv. 29 22:03:56 MyPi syncthing[10756]: Failed to exchange Hello messages (device=R4W3DFL address=192.168.1.130:22015 error=EOF log.pkg=connections)
janv. 29 22:04:56 MyPi syncthing[10756]: Failed to exchange Hello messages (device=R4W3DFL address=192.168.1.130:22015 error=EOF log.pkg=connections)
janv. 29 22:05:56 MyPi syncthing[10756]: Failed to exchange Hello messages (device=R4W3DFL address=192.168.1.130:22015 error=EOF log.pkg=connections)

Any clue please?

I can guarantee you’re not running with the pasted config, as --no-brother is not a supported config flag.

I’d suggest running syncthing manually with the flags you want and observe the resulting behavior. Then, if the same thing doesn’t happen when run from systemd, debug what systemd is doing differently…

Sorry brother :rofl:, it was a typo while redacting on another machine. The ExecStart command parameter is really --no-browser from the syncthing.service file that comes with sudo apt install

Okay, I think I forgot to add the [Service] section in the override.conf file And I also had to add ExecStart= before the full new ExecStart= .... --log-level=ERRORso that the original is reset, if not I get an error from systemd.

And now le the log is quiet :grinning_face:

[EDIT]: original post fixed with this

1 Like

Not so well fixed. The full fix is as below with:

sudo systemctl edit syncthing[@myuser].service

to insert between the dedicated comments

[Service]      #<----required
ExecStart=     #<----required
ExecStart=/usr/bin/syncthing serve --no-brother --no-restart --log-level=ERROR

or whatever log level you want, then

sudo systemctl daemon-reload   <----not sure it is required for immediate action
sudo systemctl restart syncthing[@myuser].service