if "metric" in [tags] {
stdout {
codec => line {
format => "%{host} 1m event rate: %{[events][rate_1m]}"
}
}
}
But for some reason the %{host} value is not being output and I am getting the literal string '%{host}' ouput to the console like this:
%{host} 1m event rate: 0.0
What am I doing wrong? Can we not use %{field_name} in the metrics output? I need to output a specifically formatted line for the metrics to be collected properly with my application.
Would appreciate any advice on why my fields don't appear to be available to me.
The symptoms indicate that the metrics event don't have a host field. Looking at the source it looks like it's the message field the includes the hostname. Not sure why it's done like that.
That's a bit of a disappointment, to say the least. Any ideas about how to get the Logstash hostname or other unique identifier into the metrics output? We are planning on having a cluster of LS machines and it is essential to know what kind of throughput each machine is dealing with... Would be grateful for any suggestions.
@magnusbaeck
Thanks for your input. Yes the message field does indeed contain the hostname and I was able to leverage that to generate the structure/formatting I needed. Many thanks! I do have another question about metrics but I'll create a new thread for that.
@eperry
Thanks for the suggestion. Much appreciated
I'm also experiencing the same issue, I have a 'response' field in my message, which I can use to generate a metric, but am not able to use this field to add a new field to the metric event.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.