You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem including expected versus actual behavior:
LogStash::Event does not guard against incorrect use of the top-level tagsreserved field, so it is easy to create an event or modify an event such that later processing fails in surprising and hard-to-debug ways when something downstream attempts to use Event#tag that requires the underlying tags to be a single string or a list-of-strings. Since tagging is frequently done in failure-handling scenarios, this exception is generally not caught by the plugin that is already handling an error and results in a pipeline crash.
I would expect an attempt to set the top-level tags to an unsupported value to result in an error, so that the code doing so can handle it. If an event is being created with Event::new, the caller typically already has failure handling (such as JSON and CEF codec's or Elasticsearch input's behaviour of emitting a tagged event with the original payload). If an event is being modified by a plugin with Event#set, that plugin should similarly have error handling.
We have prior art for handling @timestamp reserved field:
in Event::new, the resulting event is tagged with _timestampparsefailure and the original @timestamp value is retained in _@timestamp
when using Event#set, an unparsable timestamp results in an exception, which is handled by the caller.
Steps to reproduce:
If we create an event whose top-level tags is a key/value map:
filter{
# date filter tags when it fails to parse
mutate { "add_field" => {"when" => "yesterday" } }
date { match => ["when", "yyyymm"] }
}
Notably, The filter add_tags decorator is immune because it manipulates the event directly instead of routing through Event#tag:
filter {
mutate { "add_tag" => "kuzco" }
}
Errata
@timestamp is well-guarded, both on Event::new and Event#set
@metadata is not explicitly guarded, but reliably rejects anything other than a key/value map (with an ugly Java class cast exception); It may benefit from Event::new re-routing invalid metadata to _@metadata and a more descriptive error from Event#set.
@version is unguarded, but also has no APIs that rely on it keeping shape
tags is unguarded and needs to be
The text was updated successfully, but these errors were encountered:
Logstash information:
Everything, up to and including 8.5.0
Description of the problem including expected versus actual behavior:
LogStash::Event
does not guard against incorrect use of the top-leveltags
reserved field, so it is easy to create an event or modify an event such that later processing fails in surprising and hard-to-debug ways when something downstream attempts to useEvent#tag
that requires the underlying tags to be a single string or a list-of-strings. Since tagging is frequently done in failure-handling scenarios, this exception is generally not caught by the plugin that is already handling an error and results in a pipeline crash.I would expect an attempt to set the top-level
tags
to an unsupported value to result in an error, so that the code doing so can handle it. If an event is being created withEvent::new
, the caller typically already has failure handling (such as JSON and CEF codec's or Elasticsearch input's behaviour of emitting a tagged event with the original payload). If an event is being modified by a plugin withEvent#set
, that plugin should similarly have error handling.We have prior art for handling
@timestamp
reserved field:Event::new
, the resulting event is tagged with_timestampparsefailure
and the original@timestamp
value is retained in_@timestamp
Event#set
, an unparsable timestamp results in an exception, which is handled by the caller.Steps to reproduce:
If we create an event whose top-level
tags
is a key/value map:Subsequent use of that field can easily cause pipeline crash:
OR
OR
Notably, The filter
add_tags
decorator is immune because it manipulates the event directly instead of routing throughEvent#tag
:Errata
@timestamp
is well-guarded, both onEvent::new
andEvent#set
@metadata
is not explicitly guarded, but reliably rejects anything other than a key/value map (with an ugly Java class cast exception); It may benefit fromEvent::new
re-routing invalid metadata to_@metadata
and a more descriptive error fromEvent#set
.@version
is unguarded, but also has no APIs that rely on it keeping shapetags
is unguarded and needs to beThe text was updated successfully, but these errors were encountered: