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

[question] how to grep key value and increment counter #102

Open
kid101 opened this issue Jun 25, 2019 · 2 comments
Open

[question] how to grep key value and increment counter #102

kid101 opened this issue Jun 25, 2019 · 2 comments

Comments

@kid101
Copy link

kid101 commented Jun 25, 2019

{ "foo": "some value", "bar": "some value", "baz": "some value" }

In the readme it shows the key as foo and the plugin will count the message that contains foo key and increment the counter. How do I grep the value of foo to find hello, and if hello exists then increase the counter?

@i5okie
Copy link

i5okie commented Jul 29, 2020

need something similar.

my filter:

<filter mylabel>
  @type prometheus
  <metric>
    name router_codes
    type counter
    desc Counter of errors from Heroku Router
    <labels>
      tag ${tag}
      code ${router.code}
      dyno ${router.dest_dyno}
    </labels>
  </metric>
</filter>

Our logs are a mixed bag of data (heroku logs).
Need to count on records that exist only. like only if the key exists.
if it doesn't exist it just floods the fluentd logs, and pollutes prometheus data:

2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.code}` found
2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.dest_dyno}` found
2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.code}` found
2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.code}` found
2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.code}` found
2020-07-29 20:03:20 +0000 [warn]: unknown placeholder `${router.code}` found
2020-07-29 20:03:21 +0000 [warn]: unknown placeholder `${router.code}` found

image

@bradbeattie
Copy link

Is there a pre-existing solution to this in 2021, or should I look at writing a pull request?

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

No branches or pull requests

3 participants