How to query json url with http module

Hello Team,

I have enabled http module in metricbeat and am currently trying to get the HTTP body of a JSON endpoint.
For now it doesn't work, the error.message i get is:

json: cannot unmarshal array into Go value of type map[string]interface {}

Any ideas where I am going wrong?

content of the http.yml module:

- module: http
  metricsets: ["json"]
  period: 10s
  hosts: ["localhost:8182"]
  namespace: "json_namespace"
  path: "/TDV/isAlive"
  body: ""
  method: "GET"
  request.enabled: true
  response.enabled: true

Content of the url at http://localhost:8182/TDV/isAlive

[{"name":"smx.services","status":true},{"name":"smx.amont","status":true},{"name":"smx.core","status":true},{"name":"smx.aval","status":true},{"name":"smx.wsn.partner","status":true},{"name":"smx.mq","status":true},{"name":"GEO","status":true},{"name":"MOT1","status":true},{"name":"MOT2","status":true}]

Hi, what version of metricbeat are you running? It looks like the root element of your JSON body is an array. Metricbeat wasn't able to handle this until 6.3.0: https://github.com/elastic/beats/pull/6480.

I tried with the 6.4 version and it works perfectly !
Thanks a lot

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