# \[Jolokia module\] Get value from inner path (substructure)

**URL:** <https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 3, 2019, 3:48pm UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391 "2019-12-03T15:48:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![misocurdo](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@misocurdo](https://discuss.elastic.co/u/misocurdo)\
**Post date:** [December 3, 2019, 3:48pm UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/1 "2019-12-03T15:48:16Z")

</div>

The Jolokia documentation ([https://jolokia.org/reference/html/protocol.html#paths](https://jolokia.org/reference/html/protocol.html#paths)) shows that is possibile to retrieve value from "An inner path points to a certain substructure (plain value, array, hash) within a a complex JSON value".

With a GET the sintax to read that value is:  
`<base-url>/read/<mbean name>/<attribute name>/<inner path>`

With a POST the sintax to read that value is:  
`<base-url> { "attribute": "<attribute name>", "mbean": "<mbean name>", "path": "<inner path>", "type": "read" }`

In WebSphere AS I put this JVM custom property:  
`name: jvm.name`  
`value: <jvm_name>`

So if I call jolokia with :  
`curl "http://localhost:9999/jolokia/read/java.lang:type=Runtime/SystemProperties/jvm.name"`  
or:  
`curl -d '{"type":"read","mbean":"java.lang:type=Runtime","attribute":"SystemProperties","path":"jvm.name"}' -H "Content-Type: application/json" -X POST "http://localhost:9999/jolokia"`  
I obtain:  
`{"request":{"path":"jvm.name","mbean":"java.lang:type=Runtime","attribute":"SystemProperties","type":"read"},"value":"<jvm_name>","timestamp":<timestamp>,"status":200}`

But if in jolokia.yml I write:  
`- module: jolokia`  
` metricsets: ["jmx"]`  
` enabled: true`  
` hosts: ["localhost:9999/jolokia/"]`  
`namespace: "metrics"`  
`http_method: "POST"`  
` jmx.mappings:`  
`- mbean: 'java.lang:type=Runtime'`  
`attributes:`  
`- attr: SystemProperties`  
`path: jvm.name`  
`field: jvm.name`

I obtain the error:  
`elasticsearch/client.go:535 Cannot index event publisher`

And if in jolokia.yml I write:  
`[...]`  
` - mbean: 'java.lang:type=Runtime'`  
` attributes:`  
` - attr: 'SystemProperties/jvm.name'`  
` field: jvm.name`

I obtain the error:  
`ERROR: No such attribute: SystemProperties/jvm.name (class javax.management.AttributeNotFoundException)`

The same error appear if I write:  
`mbean: 'java.lang:type=Runtime/SystemProperties'`  
or:  
`- attr: 'SystemProperties:jvm.name'`

Which is the correct way to get value from inner path?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [December 5, 2019, 5:24am UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/2 "2019-12-05T05:24:51Z")

</div>

I'm not very familiar with the jolokia module hmm just curious have you tried this config?

```auto
[...]
- mbean: 'java.lang:type=Runtime'
attributes:
  - attr: SystemProperties
    field: jvm.name

```

---

<div class="post-metadata">

**Author:** ![misocurdo](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@misocurdo](https://discuss.elastic.co/u/misocurdo)\
**Post date:** [December 5, 2019, 9:25am UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/3 "2019-12-05T09:25:07Z")

</div>

Hi @Kaiyan_Sheng,  
the code you proposed does not just get the value of custom property jvm.name .  
With it all the content of the SystemProperties is taken, namely:

> [...]  
> "value": {  
> "FFDCLogDirectory": "/opt/IBM/WebSphere/AppServer/profiles/[...]",  
> "FFDCProcessLevel": "4",  
> "as400.suffissoMembro": "U1",  
> "awt.toolkit": "sun.awt.X11.XToolkit",  
> "client.encoding.override": "UTF-8",  
> "com.ibm.CORBA.ORBPropertyFilePath": "/opt/IBM/WebSphere/AppServer/properties",  
> "com.ibm.IPC.requestTimeout": "600",  
> "com.ibm.SOAP.requestTimeout": "600",  
> "com.ibm.as400.access.SecureAS400.useSslight": "true",  
> "com.ibm.cpu.endian": "little",  
> "com.ibm.ejs.jts.processType": "server",  
> "com.ibm.itp.location": "/opt/IBM/WebSphere/AppServer/bin",  
> "com.ibm.jcl.checkClassPath": "",  
> "com.ibm.jsse2.checkRevocation": "false",  
> [...]  
> "jvm.name": "\<jvm\_name\>",  
> [...]

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [December 6, 2019, 4:33am UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/4 "2019-12-06T04:33:16Z")

</div>

@jsoriano Do you know if we support the inner path for jolokia?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 6, 2019, 11:07am UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/5 "2019-12-06T11:07:43Z")

</div>

> [@Kaiyan\_Sheng](#):
>
> @jsoriano Do you know if we support the inner path for jolokia?

Hey, I think that we don't support it, there is an open issue about that: [Add path attribute for jolokia module · Issue #8964 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/8964)

As a possible workaround the whole object could be collected and unwanted fields could be [dropped](https://www.elastic.co/guide/en/beats/metricbeat/7.5/drop-fields.html) using processors.

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [December 6, 2019, 4:09pm UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/6 "2019-12-06T16:09:03Z")

</div>

Thank you!

---

<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:** [January 3, 2020, 4:09pm UTC](https://discuss.elastic.co/t/jolokia-module-get-value-from-inner-path-substructure/210391/7 "2020-01-03T16:09:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
