# JMX input plugin

**URL:** https://discuss.elastic.co/t/jmx-input-plugin/29417
**Category:** Logstash
**Created:** [September 16, 2015, 2:51pm UTC](https://discuss.elastic.co/t/jmx-input-plugin/29417 "2015-09-16T14:51:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tmo\_bgc](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tmo\_bgc](https://discuss.elastic.co/u/tmo_bgc)
#### Post date: [September 16, 2015, 2:51pm UTC](https://discuss.elastic.co/t/jmx-input-plugin/29417/1 "2015-09-16T14:51:31Z")

</div>

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](http://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](http://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](http://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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 5:28am UTC](https://discuss.elastic.co/t/jmx-input-plugin/29417/2 "2017-07-06T05:28:54Z")

</div>


