Skip to content

Instantly share code, notes, and snippets.

@teebu
Created March 11, 2016 22:57
Show Gist options
  • Save teebu/0c5dc6375753cc2175fa to your computer and use it in GitHub Desktop.
Save teebu/0c5dc6375753cc2175fa to your computer and use it in GitHub Desktop.
filter {
if [type] == "abc" {
metrics {
meter => "events"
add_tag => "metric"
}
}
}
output {
if "metric" in [tags] {
stdout {
codec => line {
format => "rate: %{[events][rate_1m]}"
}
}
}
}
@teebu
Copy link
Author

teebu commented Mar 11, 2016

input {
  generator {
    type => "generated"
  }
}

filter {
  if [type] == "generated" {
    metrics {
      meter => "events"
      add_tag => "metric"
    }
  }
}

output {
  # only emit events with the 'metric' tag
  if "metric" in [tags] {
    stdout {
      codec => line {
        format => "rate: %{[events][rate_1m]}"
      }
    }
  }
}

seeing:
rate: %{[events][rate_1m]}

@teebu
Copy link
Author

teebu commented Mar 11, 2016

Solved:

Output:

 format => "rate: %{events.rate_1m}"

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