[ERROR][logstash.outputs.jms ] Unknown setting 'properties' for jms


(Lindmin) #1

Hello,

We are currently trying to migrate our log centralisation handle by old logstash 2.3.2 to logstash 6.5.0.

But, we encounter an error :
[ERROR][logstash.outputs.jms ] Unknown setting 'properties' for jms

there is the output :
jms {
yaml_file => "/product/LOGSTASH/conf/conf.yml"
yaml_section => "ems"
destination => "Q.ELASTIC.INFO"
properties => { "REPORT_TYPE" => "%{type}" }
}

i didn't find any doc about the possibility of add jms properties in jms output logstash plugin in the logstash 6.5.0 doc.

How I can do it ?

Thank you.


(Lindmin) #2

Actually, it was a manual modification of the ruby code.

Here the code for thoses are interested vby this functionality
cd %logstashInstall%/vendor/bundle/jruby/%VERSION_RUBY%/gems/logstash-output-jms-%VERSION_PLUGIN%/lib/logstash/outputs
cp jms.rb jms.rb_backup

add a getter/setter for the properties :
config :properties, :validate => :hash

Then modify the receive function :

 begin
        #MODIFICATION, get message in variable
        message=@session.message(event.to_json)
 
        jms_properties={}
 
        #iterate on the properties specified in the logstash pipeline config, then add it to the message
        @properties.each do |prop,value|
           jms_properties[prop]=event.sprintf(value)
        end
        message.properties=jms_properties
        #then send the message
        @producer.send(message)
      rescue => e
        @logger.warn("Failed to send event to JMS", :event => event, :exception => e,
                     :backtrace => e.backtrace)
      end