mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
add grok named_captures_only config option
This commit is contained in:
parent
61e78df1f0
commit
17c848c915
1 changed files with 8 additions and 0 deletions
|
@ -51,6 +51,9 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
|
|||
# requested in: googlecode/issue/26
|
||||
config :drop_if_match, :validate => :boolean, :default => false
|
||||
|
||||
# If true, only store named captures from grok.
|
||||
config :named_captures_only, :validate => :boolean, :default => false
|
||||
|
||||
# Detect if we are running from a jarfile, pick the right path.
|
||||
@@patterns_path ||= Set.new
|
||||
if __FILE__ =~ /file:\/.*\.jar!.*/
|
||||
|
@ -158,6 +161,11 @@ class LogStash::Filters::Grok < LogStash::Filters::Base
|
|||
next
|
||||
end
|
||||
|
||||
if @named_captures_only && key.upcase == key
|
||||
@logger.debug("Skipping capture '#{key}' since it is not a named capture and named_captures_only is true.")
|
||||
next
|
||||
end
|
||||
|
||||
if event.fields[key].is_a?(String)
|
||||
event.fields[key] = [event.fields[key]]
|
||||
elsif event.fields[key] == nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue