Make the logfile path configurable via telegraf_logfile in /etc/rc.conf. Use daemon -H to allow logfile rotation via newsyslog. Note that /var/log/telegraf is owned by telegraf:telegraf but since the deamon process that logs telegraf output runs as root one could argue there's no reason for the logfile to not default to /var/log/telegraf.log. I can adjust my patch to make this change if that is preferable.
Created attachment 235091 [details] patch
^Triage: reset flag due to maintainer timeout.
Hi! I'm really sorry this ticket has been unattended for all these years. I've simply missed it. Now about the suggested change. One could argue that deamon(8) shouldn't manage the logging but rather this should be handled by telegraf itself, using the agent.logfile configuration directives. I don't see the point running logging the way it is done now. Please argue against this standpoint. :) Palle
In general, I think daemon should only do logging when the thing it's daemonizing is lacking the ability to do so itself. In telegraf's case it does support logging to a file. So I also think we should remove it. I've already removed it myself from the copy of the ports tree I use at $WORK. As I'm using inputs.execd to run zpool_influxdb (https://openzfs.github.io/openzfs-docs/man/master/8/zpool_influxdb.8.html) and daemon was polluting the logfile with a couple of thousand rows whenever it collected statistics.