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

Logparser: add "filename" tag to each metric for logfile differentiation when using globs #2150

Closed
deveth0 opened this issue Dec 13, 2016 · 6 comments
Milestone

Comments

@deveth0
Copy link

deveth0 commented Dec 13, 2016

Feature Request

With #1434 the very useful functionality to add a measurement per logparser grok block was added.

Proposal:

I suggest to extend this with some kind of wildcard or additional setting that would allow to add a measurement per parsed input file.

Desired behavior:

Example:
I've got ~20 different log-files in my nginx (one per vhost) that are parsed using a **access.log expression. It would be very helpful to have one measurement per file.

Of course I could add 20 grok blocks but as soon as I add or remove a vhost this will break.
Opening a feature request kicks off a discussion.

@sparrc
Copy link
Contributor

sparrc commented Dec 13, 2016

I think that adding a tag of the filename would be preferrable, and would give you the necessary separation.

@sparrc sparrc added this to the Future Milestone milestone Dec 13, 2016
@deveth0
Copy link
Author

deveth0 commented Dec 13, 2016

even better, yeah!

@sparrc sparrc changed the title Logparser: Set measurement per parsed file Logparser: add "filename" tag to each metric for logfile differentiation when using globs Dec 13, 2016
@ollybee
Copy link

ollybee commented Jan 25, 2017

Instead of creating a tag on the filename it would be better to create one on on the wildcard. the file name may not be variable but the wildcard is by definition. The tag would then still be useful in this case:

glob:
/var/log/*/access.log
paths:
/var/log/site1/access.log
/var/log/site2/access.log

@danielnelson danielnelson removed this from the Future Milestone milestone Jun 14, 2017
@danielnelson
Copy link
Contributor

@ollybee @deveth0 Does this look in line with what you expected?

[[inputs.logparser]]
  files = ["/tmp/*.log"]
  from_beginning = true
  [inputs.logparser.grok]
    patterns = ["%{NUMBER:value:float}"]
$ ls -1 /tmp/*.log
/tmp/a.log
/tmp/b.log
logparser_grok,path=/tmp/b.log value=1000 1502139594221126968
logparser_grok,path=/tmp/a.log value=42 1502139594221371694

@danielnelson danielnelson added this to the 1.4.0 milestone Aug 7, 2017
@deveth0
Copy link
Author

deveth0 commented Aug 7, 2017 via email

@danielnelson
Copy link
Contributor

Will be included in 1.4 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants