You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new logging framework doesn't seem to integrate with system logging at all. It only logs to stdout, which means it prefixes its own timestamps (even though the system already does that to all received log messages), and it doesn't have a way to fill in message priority (meaning that all messages – from debug to fatal error – become just 'info').
Would it be acceptable to add support to output log messages through Unix syslog() (e.g. --log-target=syslog, which currently I didn't find in syncthing serve --help)?
Problem or use case
Support for standard logging API would make it easier to read logs by 1) avoiding duplicate fields, and 2) allowing e.g. journalctl to highlight important messages in more obvious ways than just the 'WRN' field.
The latter would also allow existing "alert server owner on warning/error log messages" to function with Syncthing, without having to special-case syncthing's own log format.
I think the only thing that changed in this respect in 2.0 is that you can't disable the timestamp now, which is a regression of sorts that we could address. Apart from that, I believe that a stream of text lines on stdout is the closest we have to a standard logging API today. I'm not keen on special things for syslog, Windows Event Log, what have you. For any sort of systematic / at scale deployment it might make sense to have a --log-json to make the log lines more fully machine readable, though.
Apart from that, I believe that a stream of text lines on stdout is the closest we have to a standard logging API today. I'm not keen on special things for syslog, Windows Event Log, what have you
Syslog has been a "standard" logging API on Unix-like platforms for a good few years, though. It doesn't provide much in terms of machine-readability, but just having the message priority as its own field is a good first tier of filtering, and for many small deployments I don't think it is necessary to have further machine-readability beyond that – it would be enough to alert about 'all' errors and let the human take further action.
Although in my case I'm running Syncthing through systemd, which supports specifying message priorities via stdout logging as well – although using numeric values like <5> (similar to what you'd see in BSD Syslog packets) rather than INF or info=.
(But quite frankly, I've already seen several other programs claim that stdout logging is more standard, and yet every single app implements it differently.)
For any sort of systematic / at scale deployment it might make sense to have a --log-json to make the log lines more fully machine readable, though.
But I don't want "at scale" deployment, and I'm not asking for full machine readability. In fact it really baffles me that the only options are two extremes. I just want a desktop app to sync personal files between a few personal computers and a home NAS – I'm not going to run it through Kubernetes nor pipe the logs to a SIEM...
I just want a desktop app to sync personal files between a few personal computers and a home NAS – I'm not going to run it through Kubernetes nor pipe the logs to a SIEM...
Quoting Alan Kay: Simple things should be simple. Complex things should be possible.
I just want a desktop app to sync personal files between a few personal computers and a home NAS – I'm not going to run it through Kubernetes nor pipe the logs to a SIEM...
Quoting Alan Kay: Simple things should be simple. Complex things should be possible.
Although in my case I'm running Syncthing through systemd, which supports specifying message priorities via stdout logging as well – although using numeric values like <5> (similar to what you'd see in BSD Syslog packets) rather than INF or info=.
Frankly I'd be more inclined to support this, as it's a simple tweak to our log formatter that we could easily enable with --log-systemd or something.
Although in my case I'm running Syncthing through systemd, which supports specifying message priorities via stdout logging as well – although using numeric values like <5> (similar to what you'd see in BSD Syslog packets) rather than INF or info=.
Frankly I'd be more inclined to support this, as it's a simple tweak to our log formatter that we could easily enable with --log-systemd or something.
That would be very useful to have. The format is <%d> (without any space separator), the integer value being the same levels as in syslog:
IIRC, current systemd versions interpret this prefix for all services' stdout logs without having to enable anything. Previously it was a SyslogLevelPrefix= option. For testing systemd-cat also does the same.
Though --log-systemd might cause confusion with the actual systemd structured logging API, but I'm not sure of a better name, maybe --log-level-prefix.
(I'm not relaly familiar with how logging is done at scale – on my own home server I just have a basic hand-made setup where anything >= error in the system log gets emailed to me daily and >= alert goes to a Discord push notification. So for example I get notified about some service OOM-crashing, based solely on the message levels, without specifically needing to parse any message contents.)
Activity
calmh commentedon Sep 4, 2025
I think the only thing that changed in this respect in 2.0 is that you can't disable the timestamp now, which is a regression of sorts that we could address. Apart from that, I believe that a stream of text lines on stdout is the closest we have to a standard logging API today. I'm not keen on special things for syslog, Windows Event Log, what have you. For any sort of systematic / at scale deployment it might make sense to have a
--log-jsonto make the log lines more fully machine readable, though.grawity commentedon Sep 4, 2025
Syslog has been a "standard" logging API on Unix-like platforms for a good few years, though. It doesn't provide much in terms of machine-readability, but just having the message priority as its own field is a good first tier of filtering, and for many small deployments I don't think it is necessary to have further machine-readability beyond that – it would be enough to alert about 'all' errors and let the human take further action.
Although in my case I'm running Syncthing through systemd, which supports specifying message priorities via stdout logging as well – although using numeric values like
<5>(similar to what you'd see in BSD Syslog packets) rather thanINForinfo=.(But quite frankly, I've already seen several other programs claim that stdout logging is more standard, and yet every single app implements it differently.)
But I don't want "at scale" deployment, and I'm not asking for full machine readability. In fact it really baffles me that the only options are two extremes. I just want a desktop app to sync personal files between a few personal computers and a home NAS – I'm not going to run it through Kubernetes nor pipe the logs to a SIEM...
bt90 commentedon Sep 4, 2025
Quoting Alan Kay: Simple things should be simple. Complex things should be possible.
grawity commentedon Sep 4, 2025
Am I asking for anything to the contrary?
calmh commentedon Sep 4, 2025
Frankly I'd be more inclined to support this, as it's a simple tweak to our log formatter that we could easily enable with
--log-systemdor something.grawity commentedon Sep 4, 2025
That would be very useful to have. The format is
<%d>(without any space separator), the integer value being the same levels as in syslog:IIRC, current systemd versions interpret this prefix for all services' stdout logs without having to enable anything. Previously it was a
SyslogLevelPrefix=option. For testingsystemd-catalso does the same.Though
--log-systemdmight cause confusion with the actual systemd structured logging API, but I'm not sure of a better name, maybe--log-level-prefix.(I'm not relaly familiar with how logging is done at scale – on my own home server I just have a basic hand-made setup where anything
>= errorin the system log gets emailed to me daily and>= alertgoes to a Discord push notification. So for example I get notified about some service OOM-crashing, based solely on the message levels, without specifically needing to parse any message contents.)chore: add logging mode for systemd (fixes syncthing#10352)
chore: add configurable log format (fixes syncthing#10352)
chore: add configurable log format (fixes syncthing#10352)
chore: add configurable log format (fixes syncthing#10352)
chore: add configurable log format (fixes syncthing#10352)
chore: add configurable log format (fixes syncthing#10352)
chore(slogutil): add configurable logging format (fixes syncthing#10352…