Vishnu59
(Vishnu)
October 15, 2018, 5:52pm
1
Hi There,
I have setup JMX monitoring for one of our Java applications, using Logstash JMX plugin. Everything works as expected but one thing am hoping for is the way key value pair is being created. Right now after gets pushed to Elasticsearch, this is how the key value pair looks
metric_path: kafka.ReplicaManager.FifteenMinuteRate
metric_value_number: 0
What am hoping to have it stored like is below
kafka.ReplicaManager.FifteenMinuteRate: 0
This way, I would like to remove metric_path and metric_value_number fields and make the real key, value pair show as is.
Can you please suggest if there is a way I can do that?
Thanks,
Vishnu
Vishnu59
(Vishnu)
October 15, 2018, 5:57pm
2
Just an FYI, this is how my conf file looks right now
{
"host" : "172.24.24.150",
"port" : 15000,
"alias" : "kafka",
"queries" : [
{
"object_name" : "java.lang:type=Memory",
"object_alias" : "Memory"
}, {
"object_name" : "java.lang:type=Threading",
"object_alias" : "Threading"
}, {
"object_name" : "java.lang:type=Runtime",
"object_alias" : "Runtime"
}, {
"object_name" : "kafka.server:type=ReplicaManager,name=FailedIsrUpdatesPerSec",
"object_alias" : "ReplicaManager"
}]
}
Makra
(Makara)
October 16, 2018, 5:09am
3
You need to write a ruby filter to format the JMX parameters and their values .
ruby {
code => "
Metric_Path = event.get('metric_path');
Metric_Value_Number = event.get('metric_value_number');
if Metric_Path.eql?('kafka.ReplicaManager.FifteenMinuteRate')
event.set('kafka.ReplicaManager.FifteenMinuteRate, Metric_Value_Number);
end
"
}
Once the desired field is added, you can remove metric_path
and metric_value_number
from the message using drop.
Vishnu59
(Vishnu)
October 16, 2018, 4:54pm
4
Thank you very much Makra, I did this and see data being stored as expected.
Thanks,
Vishnu
Makra
(Makara)
October 17, 2018, 2:55am
5
Hi visnu, I will appreciate if you mark it as a solved.
Vishnu59
(Vishnu)
October 18, 2018, 6:03pm
6
Thank you again Makra and I just took care of that!!
system
(system)
Closed
November 15, 2018, 6:03pm
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.