taewonee
taewonee

Reputation: 1

how to get status code from logstash http filter

I am now using logstash https filter plugin

my filter part is as below

filter {
  http {
    url => "someUrl"
    verb => "GET"
    target_body => "apiResponse"
    target_headers => "apiResponseHeader"
  }
}

with http filter, I can't get HTTP response status codes

is there anyway to get HTTP status code from http filter?


target_headers give me back only this info

             "responseHeader" => {
        "transfer-encoding" => "chunked",
             "content-type" => "application/json",
                     "date" => "Thu, 09 Feb 2023 09:07:18 GMT",
               "keep-alive" => "timeout=60",
               "connection" => "keep-alive"
    },

Upvotes: 0

Views: 382

Answers (1)

Badger
Badger

Reputation: 4072

No, you cannot access the status code. When the underlying Manticore client is called, the status code is returned separately from the response headers. The http client receives and tests the code, but does not store it in the event.

Upvotes: 1

Related Questions