How to query json url with http module

(Aert) #1

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


(Shaunak Kashyap) #2

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:

(Aert) #3

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

(system) closed #4

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