Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rfc3339 timestamps w/ timezone in log output #1564

Closed
joshuaspence opened this issue Aug 1, 2016 · 4 comments · Fixed by #1879
Closed

Use rfc3339 timestamps w/ timezone in log output #1564

joshuaspence opened this issue Aug 1, 2016 · 4 comments · Fixed by #1879

Comments

@joshuaspence
Copy link

Currently Telegraf logs (written to /var/log/telegraf/telegraf.log at least for us) do not contain the timestamp. This makes it difficult to accurately ingest the logs into a logging pipeline such as Logstash.

@phemmer
Copy link
Contributor

phemmer commented Aug 1, 2016

If you're using an OS which uses systemd, personally I'd recommend editing the systemd service file and remove the redirection to the log files and let it instead go to journald. This offers a lot more flexibility in what you can do with the logs, and will also solve the timestamp issue.
If you're not using an os with systemd, you can send the output into syslog by adding the following to the end of the start command: 2>&1 | logger -t telegraf. This would also solve the timestamp issue.

The benefit of both these solutions is that they're standard practices. There's a good chance you're already consuming journald/syslog data, and so you don't need any telegraf specific configuration for logstash to read the logs.

@sparrc
Copy link
Contributor

sparrc commented Aug 1, 2016

There are timestamps?:

2016/08/01 09:39:26 Starting Telegraf (version 1.0.0-beta3-24-g1357525)
2016/08/01 09:39:26 Loaded outputs: file
2016/08/01 09:39:26 Loaded inputs: snmp
2016/08/01 09:39:26 Tags enabled: host=tars
2016/08/01 09:39:26 Agent Config: Interval:5s, Debug:false, Quiet:false, Hostname:"tars", Flush Interval:5s
2016/08/01 09:39:30 Hang on, flushing any cached metrics before shutdown
2016/08/01 09:39:30 Output [file] buffer fullness: 0 / 10000 metrics. Total gathered metrics: 0. Total dropped metrics: 0.

@sparrc sparrc closed this as completed Aug 1, 2016
@joshuaspence
Copy link
Author

Gah sorry, I meant timezones not timestamps.

@sparrc
Copy link
Contributor

sparrc commented Aug 1, 2016

OK

@sparrc sparrc reopened this Aug 1, 2016
@sparrc sparrc changed the title Include timestamp in log output Use rfc3339 timestamps in log output Aug 10, 2016
@sparrc sparrc changed the title Use rfc3339 timestamps in log output Use rfc3339 timestamps w/ timezone in log output Aug 10, 2016
sparrc added a commit that referenced this issue Oct 11, 2016
sparrc added a commit that referenced this issue Oct 11, 2016
closes #1564

also add unit and benchmark tests
sparrc added a commit that referenced this issue Oct 12, 2016
closes #1564

also add unit and benchmark tests
sparrc added a commit that referenced this issue Oct 12, 2016
closes #1564

also add unit and benchmark tests
sparrc added a commit that referenced this issue Nov 3, 2016
closes #1564

also add unit and benchmark tests
sparrc added a commit that referenced this issue Nov 3, 2016
closes #1564

also add unit and benchmark tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants