Telegraf: Systemd service file not setup to log to /var/log/telegraf/telegraf.log

Created on 17 Mar 2016  路  7Comments  路  Source: influxdata/telegraf

By default, on CentOS 7 (and I presume other systemd OSes) telegraf logging will go to the system log (/var/log/messages). It would be preferable to setup the logging to /var/log/telegraf/telegraf.log as the initd scripts do. This is also the location logrotate configuration is pointing at. Here is a link to influxdb service file which could be copied.

Most helpful comment

@anlutro are you saying the telegraf.conf should provide a config option for logging to /var/log/telegraf.log instead of only relying on systemd?

All 7 comments

@markgoffin, with that change can journalctl still be used?

@sparrc I don't think so. For InfluxDB we decided to keep logs going to /var/log/influxdb for support reasons, but I'm not sure it makes sense to do the same for Telegraf. Since every flagship Linux distribution is now using systemd, I'll imagine we'll switch to sending logs to journald at some point in the future anyways.

I'm going to close as a "won't fix", seems like we should use journald with the systemd service unless there's a good reason not to (or if other common packages are doing the same?)

OK yeah that sounds sensible. Sorry I just noticed the difference when using Telegraf on CentOS 6 and 7 and thought I'd raise it. But agreed it makes sense to stick with the most standard route for systemd.

For what it's worth, Telegraf is the only package/software I use that _doesn't_ have a configuration option to log to a file.

@anlutro are you saying the telegraf.conf should provide a config option for logging to /var/log/telegraf.log instead of only relying on systemd?

That would definitely be preferable, and I believe all the other InfluxData services have an option like that. I'm not a huge fan of journalctl in general, and out of the box on Debian 8 all of telegraf's log lines are written to /var/log/syslog, which gets quite notisy.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xiol picture Xiol  路  3Comments

efficks picture efficks  路  3Comments

SongYg picture SongYg  路  3Comments

mrcheeky123 picture mrcheeky123  路  3Comments

fahimeh2010 picture fahimeh2010  路  3Comments