mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Change event '[]' method to check @data (not just @data[@fields]) if the key starts with '@' so that grep filtering can match standard parse values
This commit is contained in:
parent
b1ed54d286
commit
d1013465b9
1 changed files with 10 additions and 1 deletions
|
@ -70,7 +70,16 @@ class LogStash::Event
|
|||
|
||||
# field-related access
|
||||
public
|
||||
def [](key); @data["@fields"][key] end # def []
|
||||
def [](key)
|
||||
# If the key isn't in fields and it starts with an "@" sign, get it out of data instead of fields
|
||||
if ! @data["@fields"].has_key?(key) and key.slice(0,1) == "@"
|
||||
@data[key]
|
||||
# Exists in @fields (returns value) or doesn't start with "@" (return null)
|
||||
else
|
||||
@data["@fields"][key]
|
||||
end
|
||||
end # def []
|
||||
|
||||
def []=(key, value); @data["@fields"][key] = value end # def []=
|
||||
def fields; return @data["@fields"] end # def fields
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue