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
With this headers attributs of message_properties will fall all time in the constant_properties because it's not of type string
A Solution could be to extract constant_properties[:headers] then do the same as the variable_properties and reseting it in constant_properties before freezing. Something like
`
def buildHeaders(event)
if @constant_properties[:headers]
constant_headers = @constant_properties[:headers].reject { |_, v| templated?(v) }
variable_headers = @constant_properties[:headers].select { |_, v| templated?(v) }
headers = variable_headers.each_with_object(constant_headers.dup) do |(k, v), memo|
memo.store(k, event.sprintf(v))
end
@constant_properties[:headers] = headers
@constant_properties.freez
end
end`
@yaauie could you help us fix this issue ? Thank you in advance
The text was updated successfully, but these errors were encountered:
DIFRIN
changed the title
Rabbitmq output plugin : dynamic values on headers not working as type is Hash and not String
Rabbitmq output plugin : dynamic values on headers not working as type is Hash not String
Feb 2, 2021
Hello
I encountered exactly the same problem on 7.1.0 and 7.1.1 versions :
headers map values (properties -> headers -> field value) are not templated
(only properties fields of type string are templated)
example to reproduce: input: id-var="id-value"
output{
rabbitmq {
exchange => "my-exchange"
exchange_type => "topic"
user => "my-user"
password => "my-password"
key => "%{[@metadata][routing_key]}"
host => "my-host"
port => 35672
properties => {
headers => {
id => "%{[id-var]}"
version => "1.0"
}
}
}
}
expected message body in rabbitmq : {"id" : "id-value", "date" : "2021-02-03-15.31.32.708295"}
but was : {"id" : "%{[id-var]}", "date" : "2021-02-03-15.31.32.708295"}
logstash-integration-rabbitmq/lib/logstash/outputs/rabbitmq.rb
Line 146 in 1d8117c
A Solution could be to extract constant_properties[:headers] then do the same as the variable_properties and reseting it in constant_properties before freezing. Something like
`
def buildHeaders(event)
@yaauie could you help us fix this issue ? Thank you in advance
The text was updated successfully, but these errors were encountered: