Handling exception from HTTP logstash 6.8

Hello -

I am trying to handle exception in my logstash after HTTP filter plugin. I am using Logstash version 6.8. I have couple of question on this -

  1. How to handle exception if the HTTP response code is other than 200?
  2. When there is any HTTP exception, i see tags getting the exception. But without knowing the actual values of the tags, how can i check for and handle that? For ex, if my Http times out, i don't know what exception gets added to the tag.

Thanks.

The default value for tag_on_request_failure _httprequestfailure. You get the same tag if the http client throws an exception (I think that includes a time) or if the http status is outside of the range 200-299.

That means you cannot distinguish between a timeout, a 403, a 500 etc.

Thank you.
So, if the HTTP fails because of Authentication or if fails due to timeout or response code other than 200-299, we get the same tag '_httprequestfailure'. Is that correct?

Is there a way to get the HTTP response code in 6.8? i see in 7.8, there was an option.

Yes, that is correct.

There is no way to get the response code for a failure. If you look at the code process_response does not get called if there is an error or a response code outside of 200-299. It is not like an http_poller input where you can get the metadata for both successes and failures.

ok. Thank you so much for quick reply. That helps.