I use jolokia module with auto-discovery while the metrics are scrapped from multiple agents. The metrics are properly exported to Elasticsearch, however if I have a few agents from which I collect the same metrics and my condition is based on jolokia.agent.id partial name then all the events are exported with the same jolokia.agent.id/jolokia.url .
In more details: assume I have 2 different agents - one has jolokia.agent.id called myapp1 and the second myapp2.
My metricbeat.yml configuration looks like that:
- type: jolokia
- module: jolokia
Pay attention that the condition "jolokia.agent.id: myapp" applies to my both agents (myapp1 and myapp2) and indeed the metrics are coming from both properly. However, jolokia.agent.id and jolokia.url values are the same (lets say those from myapp1) in all events, i.e. also in those which belong to myapp2. I intentionally use jolokia.agent.id: "myapp" condition as the configuration is identical to both of them and thus my metricbeat.yml is much simpler (no need to duplicate the same configuration). BTW, service.address is correct. I actually lose identification from where my metrics came, so this is important to me.