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

Added: support for timeout_scope #153

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Docs: update plugin docs with timeout_scope config
kares committed Nov 15, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 0224744975830b2345d95a09c88a65cafb10dade
17 changes: 17 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
@@ -195,6 +195,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
| <<plugins-{type}s-{plugin}-tag_on_failure>> |<<array,array>>|No
| <<plugins-{type}s-{plugin}-tag_on_timeout>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-timeout_millis>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-timeout_scope>> |<<string,string>>|No
|=======================================================================

Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
@@ -356,6 +357,22 @@ This will never timeout early, but may take a little longer to timeout.
Actual timeout is approximate based on a 250ms quantization.
Set to 0 to disable timeouts

[id="plugins-{type}s-{plugin}-timeout_scope"]
===== `timeout_scope`

* Value type is <<string,string>>
* Default value is `"pattern"`
* Supported values are `"pattern"` and `"event"`

When multiple patterns are provided to <<plugins-{type}s-{plugin}-match>>,
the timeout has historically applied to _each_ pattern, incurring overhead
for each and every pattern that is attempted; when the grok filter is
configured with `timeout_scope => event`, the plugin instead enforces
a single timeout across all attempted matches on the event, so it can
achieve similar safeguard against runaway matchers with significantly
less overhead.

It's usually better to scope the timeout for the whole event.


[id="plugins-{type}s-{plugin}-common-options"]
13 changes: 8 additions & 5 deletions lib/logstash/filters/grok.rb
Original file line number Diff line number Diff line change
@@ -215,11 +215,14 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
# Set to 0 to disable timeouts
config :timeout_millis, :validate => :number, :default => 30000

# Timeouts are per pattern matched by default but for multiple matches over a
# particular field it's usually better to scope the timeout for the whole event.
# The `timeout_millis` than effectively becomes a timeout over several matches.
# Default is false due backwards compatibility.
# Has only an effect when timeout_millis > 0
# When multiple patterns are provided to `match`,
# the timeout has historically applied to _each_ pattern, incurring overhead
# for each and every pattern that is attempted; when the grok filter is
# configured with `timeout_scope => 'event'`, the plugin instead enforces
# a single timeout across all attempted matches on the event, so it can
# achieve similar safeguard against runaway matchers with significantly
# less overhead.
# It's usually better to scope the timeout for the whole event.
config :timeout_scope, :validate => %w(pattern event), :default => "pattern"

# Tag to apply if a grok regexp times out.