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.
@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.
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?