Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always process body and headers on any http response #31

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/logstash/filters/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,20 @@ def filter(event)
:url => url_for_event, :body => body_sprintfed,
:client_error => client_error.message)
@tag_on_request_failure.each { |tag| event.tag(tag) }
elsif !code.between?(200, 299)
@logger.error('error during HTTP request',
:url => url_for_event, :code => code,
:response => response_body)
@tag_on_request_failure.each { |tag| event.tag(tag) }
return
else
process_response(response_body, response_headers, event)
end

if code.between?(200, 299)
@logger.debug? && @logger.debug('success received',
:code => code, :body => response_body)
process_response(response_body, response_headers, event)
filter_matched(event)
else
@logger.error('error during HTTP request',
:url => url_for_event, :code => code,
:response => response_body)
@tag_on_request_failure.each { |tag| event.tag(tag) }
end
end # def filter

Expand Down