Manish Sapariya
Manish Sapariya

Reputation: 3605

How to get metric plugin working in logstash

I am failing to understand how to print the metric.

With following logstash config

input {
  generator {
    type => "generated"
  }
}
filter {
  metrics {
    type => "generated"
    meter => "events"
    add_tag => "metric"
  }
}
output {
  stdout {
    tags => "metric"
    message => "rate: %{events.rate_1m}"
  }
}

all I see is

rate: %{events.rate_1m}
rate: %{events.rate_1m}

instead of actual value.

When I enable debug in stdout I see that @fileds have the data that metric is support to print.

 "@fields" => {
           "events.count" => 114175,
         "events.rate_1m" => 6478.26368594885,
         "events.rate_5m" => 5803.767865770155,
        "events.rate_15m" => 5686.915084346328
    },

How do I access @fields.events.count? logstash version = 1.1.13

Upvotes: 0

Views: 2204

Answers (1)

Manish Sapariya
Manish Sapariya

Reputation: 3605

It looks like a known issue in logstash 1.1.13 and lower.

One need to escape '.' in %{events.rate_1m} as %{events\.rate_1m}

Details are in this logstash JIRA

Upvotes: 1

Related Questions