Add_field compatibility problem (upgrade from 1.4.2. to 1.5.2)

(Karel Bělunek) #1

I find out problem with add_field instruction after upgrade from 1.4.2 to 1.5.2.

I use add_field directive in my stomp input plugin to mark the message with information from with input it arrives in my custom attribute "logtype". I am using logtype to drive my filtering logic. I cannot use standard type attribute because it is immutable and I need to mutate log type during processing (that includes external processing in ActiveMQ).

If the incoming message have alreadey defined logtype attribute, in the version 1.4.2 the value has been replaced, which is wanted behaviour. It is also in accordance with documentation that add_field modifies hash value.
In the 1.5.2, if the atribute was set, the attribute is modified to array, old value is retained as first array item and the new value is placed as second array item.

There is my code snippet:

stomp {
destination => "/topic/stdlog"
host => "localhost"
port => 61613
codec => "json"
type => "jsonstdlog"
add_field => { "logtype" => "jsonstdlog" }

An there is debuglog value (the incoming message have set logtype="satsyslog"):
"logtype" => [
[0] "satsyslog",
[1] "jsonstdlog"

In the 1.4.2 the log type value was simply replaced by "jsonstdlog", 1.4.2 version output:
"logtype" => "jsonstdlog"

Is it bug or feature?
The documentation is vague in this particular problem and does not define proper behaviour.
I thought it is bug, because hash data type behaviour is usually considered in 1.4.2 way.

(system) #2