Monitor APIs using MetricsBeat

Hello,

I would like to monitor an API call from ES and Kibana. The HTTP module in MetricBeat seems like the most logical choice. I have installed it, and I see that it is writing to ES. However, I am having issues configuring it. So far, I have this:

  • module: http
    metricsets:
    • json
      period: 10s
      hosts: ["https://"]
      namespace: "json_namespace"
      path: "/"
      #path: "/"
      ssl.verification_mode: none
      #body: ""
      method: "GET"
      #username: "user"
      #password: "secret"
      request.enabled: true
      response.enabled: true
      #json.is_array: false
      #dedot.enabled: false

However, I keep getting, in Kibana, the following error:
"Authorization has been denied for this request"

I have tried adding the header for the API_KEY and its value, but no luck. I confirm that from the ES server, the curl command with the API_KEY and its value added as a header returns the query results. Would any know how I can add the header? I tried

header: "API_KEY:"
headers: "API_KEY:"

and a bunch of variations... It seems to simply ignore the information. nay help would be greatly appreciated.

A note for the entry above: not all of the values were accepted, so let me try the confirguation again:

module: http
metricsets:

  • json
    period: 10s
    hosts: ["https://valueofserviceURL"]
    namespace: "json_namespace"
    path: "/pathofAPI"
    #path: "/"
    ssl.verification_mode: none
    #body: ""
    method: "GET"
    #username: "user"
    #password: "secret"
    request.enabled: true
    response.enabled: true
    #json.is_array: false
    #dedot.enabled: false

I tried adding:
header: "API_KEY:value"
headers: "API_KEY:value"

Hi @RunningSmurf :slightly_smiling_face:

I'd say that your headers format is not correct, check here https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-ssl.html

It should be

headers:
  API_KEY: "value"

Best regards!

Thank you, this worked!

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