title: logstash apply multiple filters based on condition
body: <p>I have log lines as belows:</p>
  
  <pre><code>11:05:44,924 DEBUG DataFeed:? - Data received: data=TextMessage={ Header={ JMSMessageID={ID:someId} JMSDestination={Topic[someTopic]} JMSReplyTo={null} JMSDeliveryMode={NON_PERSISTENT} JMSRedelivered={false} JMSCorrelationID={null} JMSType={null} JMSTimestamp={Tue Aug 30 11:05:44 BST 2016} JMSExpiration={Tue Aug 30 11:06:44 BST 2016} JMSPriority={4} } Properties={ ACTION={String:ADD} XT_S_USER={String:someString} APPNAME={String:someFeeName} XT_BOOK={String:someBook} } Text={&lt;?xml version="1.0"?&gt;&lt;!DOCTYPE PSRequest&gt;&lt;PSRequest&gt;&lt;trade&gt;..XML Tags..&lt;/trade&gt;&lt;/PSRequest&gt;} }
  </code></pre>
  
  <p>I am trying to apply XML filter on the above log line which fails with:</p>
  
  <pre><code>:exception=&gt;#&lt;NoMethodError: undefined method `start_with?' for nil:NilClass&gt;, :backtrace=&gt;["/jruby/1.9/gems/logstash-core-event-2.3.2-java/lib/logstash/event.rb:130:in `[]='", "/jruby/1.9/gems/logstash-filter-xml-2.1.4/lib/logstash/filters/xml.rb:166:in `filter'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/filters/base.rb:151:in `multi_filter'", "org/jruby/RubyArray.java:1613:in `each'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/filters/base.rb:148:in `multi_filter'", "(eval):41:in `filter_func'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/pipeline.rb:267:in `filter_batch'", "org/jruby/RubyArray.java:1613:in `each'", "org/jruby/RubyEnumerable.java:852:in `inject'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/pipeline.rb:265:in `filter_batch'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/pipeline.rb:223:in `worker_loop'", "/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/pipeline.rb:201:in `start_workers'"], :level=&gt;:warn}
  </code></pre>
  
  <p>Also certain lines do not have XML content, I want to send them to a grok filter, how should I achieve this?</p>
  
  <p>EDIT: 
  Small snippet as to how to achieve below <br>
  My case is something like this:</p>
  
  <pre><code>if(message.contains(certainText)) {
  //apply grok filter and extract xml from it and send it to xml filter and then to ES
  } else if(message.contains(someOtherText)) {
  //Apply grok filter and extract key value pairs and send it to kv filter and then to ES
  } else {
  //straight away send that message to ES without any parsing.
  }
  </code></pre>