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

Doc how to parse telegraf logs #4285

Merged
merged 2 commits into from
Aug 14, 2018

Conversation

adrianlzt
Copy link
Contributor

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@adrianlzt adrianlzt force-pushed the feature/logparser_telegraf_log branch 2 times, most recently from 57f78a3 to e1c4847 Compare June 14, 2018 08:04
@adrianlzt adrianlzt force-pushed the feature/logparser_telegraf_log branch from e1c4847 to 1030078 Compare June 14, 2018 08:06
Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this will be a handle tutorial as well as being directly useful.

We can use logparser to convert the log lines generated by Telegraf in metrics.

To do this we need to configure Telegraf to write logs to a file (if we have systemd, by
default, it will be written to journald):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't always the case, on most systems I have tested by default journald is setup to forward to rsyslog, when then writes the logs to /var/log/syslog. See #4174

What's important is that the admin sets up the telegraf logs to go into a dedicated file, and this will do that, but maybe we should also mention that on some systems you can also do this from your syslog handler.


[inputs.logparser.grok]
measurement = "telegraf_log"
patterns = ['\A%{TIMESTAMP_ISO8601:timestamp:ts-rfc3339} %{TELEGRAF_LOG_LEVEL:level:tag}! %{GREEDYDATA:msg}']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\A?

@danielnelson danielnelson added this to the 1.8.0 milestone Jun 14, 2018
@danielnelson danielnelson added docs Issues related to Telegraf documentation and configuration descriptions area/tail labels Jun 14, 2018
…e 'beginning of line' instead of 'beginning of text'
@glinton glinton merged commit e50b0c1 into influxdata:master Aug 14, 2018
rgitzel pushed a commit to rgitzel/telegraf that referenced this pull request Oct 17, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tail docs Issues related to Telegraf documentation and configuration descriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants