just a simple question. What’s the current best practice for logfile rotation? I start syncthing on FreeBSD with -logfile /var/log/syncthing.log. I have a newsyslog.conf line, which rotates that file daily:
“Problem” is that newsyslog sends SIGHUP to syncthing which restarts syncthing. I think it is not needed to restart syncthing completely when the logfile-filedescriptor changes. What’s the cleanest way to do this? Why don’t we have a SIGHUP handler that reloads the logfile, and, for instance a SIGUSR1 handler which restarts syncthing instead?
No, it’s open()ed from within write() when necessary.
However as you’re running it as a service of some kind you might want to just integrate it with syslog instead anyway. I usually end up with something similar to syncthing -no-restart -logflags 0 | logger -t syncthing and then routing the messages appropriately in your syslog config.