Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 12.1.3
- Improves the logging experience when DLQ used [#1253](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1253)

## 12.1.2
- Fix: replace deprecated `File.exists?` with `File.exist?` for Ruby 3.4 (JRuby 10) compatibility [#1238](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1238)

Expand Down
11 changes: 11 additions & 0 deletions lib/logstash/plugin_mixins/elasticsearch/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def submit(actions)
end

actions_to_retry = []
dlq_reouted_stats = {}
Comment thread
mashhurs marked this conversation as resolved.
Outdated
responses.each_with_index do |response,idx|
action_type, action_props = response.first

Expand All @@ -296,6 +297,11 @@ def submit(actions)
elsif @dlq_codes.include?(status)
handle_dlq_response("Could not index event to Elasticsearch.", action, status, response)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about DLQ'd events going to the debug log?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk good question! Yesterday it took me ~15min to decide to go with warning. Why?!- I consider this case need an ATTENTION. But I am open to change if you have strong point.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if there is a misunderstanding - my comment was whether we should consider the reason for all events going to the DLQ at a debug level, not the "summary" message, which I think a warn is appropriate, although I could be persuaded that it is an info level

@document_level_metrics.increment(:dlq_routed)
if dlq_reouted_stats.key?(status)
dlq_reouted_stats[status][:count] += 1
else
dlq_reouted_stats[status] = { :count => 1, :sample_event => { :action => action, :response => response } }
end
next
else
# only log what the user whitelisted
Expand All @@ -305,6 +311,11 @@ def submit(actions)
end
end

if @dlq_writer && !dlq_reouted_stats.empty?
total = dlq_reouted_stats.values.sum { |entry| entry[:count] }
@logger.warn("Events could not be indexed and routing to DLQ", :count => total, :dlq_reouted_stats => dlq_reouted_stats)
end

actions_to_retry
end

Expand Down
2 changes: 1 addition & 1 deletion logstash-output-elasticsearch.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-output-elasticsearch'
s.version = '12.1.2'
s.version = '12.1.3'
s.licenses = ['apache-2.0']
s.summary = "Stores logs in Elasticsearch"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand Down
Loading