Monday, January 25, 2016

Using Weblogic JMS as input in Logstash

I am using Logstash 2.1.1.

There is a jms Logstash input plugin at https://github.com/logstash-plugins/logstash-input-jms

Install it:

$LOGSTASH_HOME/bin/plugin install logstash-input-jms

To use it, we need to create a jms.yml configuration file for the plugin.

weblogic:
  :jndi_name: jms/DemoCF
  :jndi_context:
    java.naming.factory.initial: weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url: t3://localhost:7001
    java.naming.factory.url.pkgs: javax.naming:javax.jms
    java.naming.security.principal: weblogic
    java.naming.security.credentials: welcome1
  :require_jars:
    - /Users/jpvadell/oracle/weblogic/12.2.1.0/wlserver/server/lib/wlthint3client.jar
    - /Users/jpvadell/oracle/weblogic/12.2.1.0/wlserver/server/lib/wljmsclient.jar
    - /Users/jpvadell/oracle/weblogic/12.2.1.0/wlserver/server/lib/wlclient.jar

I am using Weblogic 12.2.1 jars connecting to an older Weblogic server without any trouble.

Then we must create the logstash configuration file logstash-wlsjms.conf

input {
  jms {
     use_jms_timestamp => false
     yaml_file => "$LOGSTASH_CONFIG_HOME/conf/jms/jms.yml"
     yaml_section => "weblogic"
     destination => "DemoJMSServer/DemoJMSModule!DemoQ"
  }
}
output {
    elasticsearch { hosts => ["localhost:9200"] }
    stdout { codec => rubydebug }
}

The destination tag is JMSSERVER_NAME/JMS_MODULE!QUEUENAME (not jndi QueueName)

Run it! 

$LOGSTASH_HOME/bin/logstash -f $LOGSTASH_CONFIG_HOME/conf/logstash-wlsjms.conf



Put some messages at the JMS Queue and check it at Kibana.

Enjoy!!

JP