-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
Would it be possible to assign a value to some extra field depending on which grok pattern matches. To slightly modify the example from another question (#44):
<source>
@type tail
path /path/to/log
parsetype_key myeventtype
<parse>
@type grok
<grok>
pattern %{COMBINEDAPACHELOG}
time_format "%d/%b/%Y:%H:%M:%S %z"
parsetype_value apachelog
</grok>
<grok>
pattern %{IP:ip_address}
parsetype_value ipline
</grok>
<grok>
pattern %{GREEDYDATA:message}
parsetype_value message
</grok>
</parse>
</source>
The resulting event would have a new field named 'myeventtype' which would have the value of 'apachelog', 'ipline', 'message' depending on which of the grok patterns hit. If they all miss, maybe the default could be 'unknown' or something. The parsetype_key and parsetype_value configuration names are just suggestions on how it might be configured.
So, a good idea, or is there perhaps already a better way to achieve this sort of thing?
Metadata
Metadata
Assignees
Labels
No labels