Metricbeat http http.json: invalid character '<' looking for beginning of value error

Hi,
I configured in metricbeat the http module as below example, but I am getting the following error : http.json: invalid character '<' looking for beginning of value.

# Module: http
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-http.html

- module: http
  metricsets:
    - json
  period: 5s
  hosts: ["localhost:5601"]
  namespace: "json_namespace"
  path: "/"
  #body: ""
  #method: "GET"
  #username: "user"
  #password: "secret"
  #request.enabled: false
  #response.enabled: false
  #json.is_array: false
  #dedot.enabled: false

- module: http
  metricsets:
    - server
  host: "localhost"
  port: "8080"
  enabled: false
  #paths:
  #  - path: "/foo"
  #    namespace: "foo"
  #    fields: # added to the the response in root. overwrites existing fields
  #      key: "value"

Please advise on solution

Can you post the entire error? It should have highlighted where it saw the syntax issue.

That error indicates that you're most likely getting back HTML instead of JSON from the HTTP server.

Looking at your configuration for the http module, json metricset, you're pointing to localhost:5601/. Typically that's the port used by Kibana. Is that what you're running or are you running some other HTTP service on 5601? If it's Kibana, then it's going to return HTML, not JSON.

All of this begs the question: what are you trying to achieve here? What's your end goal? Knowing that might help us point you in the right/better direction.

Thanks,

Shaunak

1 Like

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