# Metricbeat - Error creating runner from config: failed to initialize condition

**URL:** https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449
**Category:** Beats
**Tags:** metricbeat
**Created:** [October 26, 2022, 12:41am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449 "2022-10-26T00:41:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![stefws](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefws/32/6442_2.png) [@stefws](https://discuss.elastic.co/u/stefws)
#### Post date: [October 26, 2022, 12:41am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/1 "2022-10-26T00:41:35Z")

</div>

Attempting to fetch various bean data from Jboss instances by means of jolokia some works others fail though I can fetch them with curl, any hints appreciated on what/which condition is missing or faulty, TIA!

Getting errors like this

```auto
{"log.level":"error","@timestamp":"2022-10-26T01:50:26.555+0200","log.logger":"reload","log.origin":{"file.name":"cfgfile/list.go","file.line":99},"message":"Error creating runner from config: failed to initialize condition: missing or invalid condition","service.name":"metricbeat","ecs.version":"1.6.0"}

```

with a config like this:

```auto
- module: jolokia
  index: "%{[agent.name]}-%{[agent.version]}-jboss"
  namespace: "jboss.ws"
  metricsets: ["jmx"]
  processors:
    - drop_event:
        when:
            - has_fields: ['error.message']
    - add_fields:
        target: 'jolokia'
        fields:
          instance: "<instance name>"
  period: 1m
  hosts: [http://localhost:27380]
  path: "hawtio/jolokia/?ignoreErrors=true&canonicalNaming=false"
  username: "${JBOSS_USER}"
  password: "${JBOSS_PWD}"
  jmx.mappings:
    - mbean: "jboss.ws:context=*,endpoint=*"
      attributes:
        - attr: "ObjectName"
          field: "objectname"
        - attr: "TotalProcessingTime"
          field: "processingtime.total"
        - attr: "AverageProcessingTime"
          field: "processingtime.avg"
        - attr: "MaxProcessingTime"
          field: "processingtime.max"
        - attr: "MinProcessingTime"
          field: "processingtime.min"
        - attr: "FaultCount"
          field: "counts.fault"
        - attr: "RequestCount"
          field: "counts.request"
        - attr: "ResponseCount"
          field: "counts.response"

```

fetch bean data from curl works fine using same credentials:

```auto
$ curl -u luser 'http://localhost:27380/hawtio/jolokia/read/jboss.ws:context=*,endpoint=*/*'
Enter host password for user 'luser':
{"request":{"mbean":"jboss.ws:context=*,endpoint=*","type":"read"},"value":{"jboss.ws:context=main-server,endpoint=KalenderUdrulEndpointImpl":{"Address":"http:\/\/jbossws.undefined.host:27380\/main-server\/KalenderUdrulEndpointImpl","TotalProcessingTime":0,"UpdateTime":0,"FaultCount":0,"MinProcessingTime":0,"AverageProcessingTime":0,"RequestCount":0,"ResponseCount":0,"RecordProcessors":[{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processDestinationHost":true,"processDate":true,"name":"LogRecorder","processMessageType":true,"processEnvelope":true,"recording":false,"filters":[]},{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processMessageType":true,"processEnvelope":true,"recording":false,"maxSize":50,"filters":[],"size":0,"processDestinationHost":true,"processDate":true,"name":"MemoryBufferRecorder","clientHosts":[]}],"MaxProcessingTime":0},"jboss.ws:context=main-server,endpoint=SmsSendingEndpointImpl":{"Address":"http:\/\/jbossws.undefined.host:27380\/main-server\/SmsSendingEndpointImpl","TotalProcessingTime":0,"UpdateTime":0,"FaultCount":0,"MinProcessingTime":0,"AverageProcessingTime":0,"RequestCount":0,"ResponseCount":0,"RecordProcessors":[{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processDestinationHost":true,"processDate":true,"name":"LogRecorder","processMessageType":true,"processEnvelope":true,"recording":false,"filters":[]},{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processMessageType":true,"processEnvelope":true,"recording":false,"maxSize":50,"filters":[],"size":0,"processDestinationHost":true,"processDate":true,"name":"MemoryBufferRecorder","clientHosts":[]}],"MaxProcessingTime":0},...

```

from same jolokia.yml this module config is working just fine and sending data:

```auto
- module: jolokia
  index: "%{[agent.name]}-%{[agent.version]}-jvm"
  namespace: "jvm"
  metricsets: ["jmx"]
  processors:
    - drop_event:
        when:
          has_fields: ['error.message']
    - add_fields:
        target: 'jolokia'
        fields:
          instance: "<instance name>"
  period: 1m
  hosts: [http://localhost:27380]
  path: "hawtio/jolokia/?ignoreErrors=true&canonicalNaming=false"
  username: "${JBOSS_USER}"
  password: "${JBOSS_PWD}"
  jmx.mappings:
    - mbean: "java.lang:name=*,type=GarbageCollector"
      attributes:
        - attr: Name
          field: gc.name
        - attr: CollectionTime
          field: gc.time
        - attr: CollectionCount
          field: gc.count
        - attr: LastGcInfo
          field: gc.last

```

---

<div class="post-metadata">

### Author: ![Manoj\_S\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manoj_s_shetty/32/101950_2.png) [@Manoj\_S\_Shetty](https://discuss.elastic.co/u/Manoj_S_Shetty)
#### Post date: [October 26, 2022, 5:42am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/2 "2022-10-26T05:42:35Z")

</div>

Hi @stefws ,

i see there is " " quotes in the first config file and in the second config file i do not see " " for attr and field.  
Can we try removing those quotes for `- attr:` and `- field:`

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [October 26, 2022, 5:53am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/3 "2022-10-26T05:53:59Z")

</div>

> [@stefws](#):
>
> ```auto
> "Error creating runner from config: failed to initialize condition: missing or invalid condition","service.name":"metricbeat","ecs.version":"1.6.0"}
> 
> ```

I think condition should be:  
when:  
equals:  
somevalue

---

<div class="post-metadata">

### Author: ![stefws](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefws/32/6442_2.png) [@stefws](https://discuss.elastic.co/u/stefws)
#### Post date: [October 26, 2022, 6:35am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/4 "2022-10-26T06:35:53Z")

</div>

Thanks for pointing out the area, has\_field shouldn't have a dash prefix '-' now it works it must have been too late in the day/night 🙂

---

<div class="post-metadata">

### Author: ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)
#### Post date: [October 26, 2022, 7:02am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/5 "2022-10-26T07:02:53Z")

</div>

Long live the king and the Elastic team.

---

<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: [November 23, 2022, 9:03am UTC](https://discuss.elastic.co/t/metricbeat-error-creating-runner-from-config-failed-to-initialize-condition/317449/6 "2022-11-23T09:03:50Z")

</div>

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