0
多個過濾器我有日誌行作爲初級講座:logstash應用基於條件
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={<?xml version="1.0"?><!DOCTYPE PSRequest><PSRequest><trade>..XML Tags..</trade></PSRequest>} }
我想上失敗,上面日誌行應用XML過濾器:
:exception=>#<NoMethodError: undefined method `start_with?' for nil:NilClass>, :backtrace=>["/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=>:warn}
也一定行沒有XML內容,我想將它們發送到grok過濾器,我應該如何實現這一點?
編輯: 小片段就如何實現以下
我的情況是這樣的:
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.
}
喜將ü能夠提出小片段就如何實現上述片段request..no需要的內部細節,只是如何實現語法這 –