Bug 265052 - net-mgmt/telegraf: Add rc.conf configured logfile path, use daemon -H for logfile rotation
Summary: net-mgmt/telegraf: Add rc.conf configured logfile path, use daemon -H for log...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Palle Girgensohn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-05 21:00 UTC by Craig Leres
Modified: 2026-03-19 08:48 UTC (History)
2 users (show)

See Also:


Attachments
patch (1.91 KB, patch)
2022-07-05 21:00 UTC, Craig Leres
leres: maintainer-approval? (girgen)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer freebsd_triage 2022-07-05 21:00:04 UTC
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.
Comment 1 Craig Leres freebsd_committer freebsd_triage 2022-07-05 21:00:38 UTC
Created attachment 235091 [details]
patch
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2025-05-06 04:18:53 UTC
^Triage: reset flag due to maintainer timeout.
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2025-05-06 10:56:42 UTC
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
Comment 4 Johan Söllvander freebsd_committer freebsd_triage 2026-03-19 08:48:59 UTC
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.