JMX input plugin


#1

Hi Everyone,

My apologies as I am new to Logstash. I am attempting to use the JMX input plugin and hoping to get some help.

The JMX plugin produces a LogStash Event object.

Is there a filter, or a solution out of the box that allows me to convert the contents of the Event object into the following json String format?

Source Logstash Event object structure(This is the output of the JMX plugin with "codec => rubydebug" set):

{
"@version" => "1",
"@timestamp" => "2015-09-15T22:18:20.191Z",
"host" => "somehost.mycompany.com",
"path" => "c:/LogStash/jmxconf/",
"type" => "jmx",
"metric_path" => "somehost.mycompany.com_9119.Memory.HeapMemoryUsage.committed",
"metric_value_number" => 151519232,
}
{
"@version" => "1",
"@timestamp" => "2015-09-15T22:18:20.231Z",
"host" => "somehost.mycompany.com",
"path" => "c:/LogStash/jmxconf/",
"type" => "jmx",
"metric_path" => "somehost.mycompany.com_9119.Memory.NonHeapMemoryUsage.committed",
"metric_value_number" => 61210624,
}

Desired target output String:

{ "create" : { } }
{"name":"HeapMemoryUsage","type":"MEMORY","committed":150470656,"@timestamp":"2015-09-03T21:26:02.363Z"}
{ "create" : { } }
{"name":"NonHeapMemoryUsage","type":"MEMORY","committed":61014016,"@timestamp":"2015-09-03T21:26:02.363Z"}

Please keep in mind that the "Source Logstash Event object" is an object and not a string.

Here is my JMX config json incase you need:

{
"host" : "somehost.mycompany.com",
"port" : 9119,
"queries" : [
{
"object_name" : "java.lang:type=Memory",
"object_alias" : "Memory"
} ]
}

My logstash-mule.conf:

input {
jmx {
path => "c:/LogStash/jmxconf/"
polling_frequency => 15
type => "jmx"
nb_thread => 4
codec => json
}

}

????What to insert here to get desired target string output????

output {
stdout { codec => rubydebug }
}

Many thanks in advance

Tony


(system) #2