"HTTP 405 Method Not Allowed" on only a single end-point

(Kishore) #1


I’ve set-up a Graylog cluster and the UI works fine, indexing is fine, but I get a “405 method not allowed” error when I hit the following end-point alone:


The exact error message is:

{“type”:“ApiError”,“message”:“HTTP 405 Method Not Allowed”}

My configuration looks like this:

rest_listen_uri = "http://graylog.test:9000/api/"
rest_transport_uri = "http://graylog.test:9000/api/,
web_listen_uri = “http://graylog.test:9000/

Other API end-points like “/api/system/metrics/” and “/api/system/inputstates” work fine.

I don’t see any error messages in the server log. What could be going wrong?


I’m using Graylog 2.2



(Pål Nilsen) #2

That’s because it doesn’t want GET requests. (Mine does the same thing and my cluster works fine.)

(Jochen) #3

What kind of HTTP request (HTTP method, headers, request body) are you sending to http://graylog.test:9000/api/system/metrics/multiple/?

(Kishore) #4

Shortly after posting my question, I realized that the end-point is probably expecting a POST (I was doing a GET earlier), but when I POST like:

curl -u admin -H 'Content-Type: application/json' -X POST -d '{"metrics":["org.graylog2.buffers.input.usage"]}' http://graylog.test:9000/api/system/metrics/multiple

I’m prompted for a password and when I enter the password, I now get a {"type":"ApiError","message":"HTTP 500 Internal Server Error"}% response.

EDIT: copy fail - it was a 500 response (updated the post)



(Kishore) #5

Figured it out. I needed a -H 'Accept: application/json' as well in addition. I’m sorry for bothering. I hope somebody else finds it helpful.

(Jochen) #6

As a summary, this curl command is working:

$ curl -u $USER:$PASSWORD \
  -X POST \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'
  -d '{"metrics":["org.graylog2.buffers.input.usage"]}' \
  "total" : 1,
  "metrics" : [ {
    "full_name" : "org.graylog2.buffers.input.usage",
    "metric" : {
      "value" : 0
    "name" : "usage",
    "type" : "gauge"
  } ]