如何从logstash中删除xml属性值并传递给elasticserach?

时间:2016-01-15 06:08:50

标签: logstash

这是xml文件,Tag test-methode包含name = reEnterURL,每次测试都重复。我不想将此值传递给弹性搜索。只有status = pass name = newProfile才能通过弹性搜索。

 </test-method> 
    <test-method status="PASS" signature="reEnterURL()[pri:0, instance:testSuite.DriverScript_Transformation@6fc757]" name="reEnterURL" is-config="true" duration-ms="1107" started-at="2015-12-30T15:55:24Z" finished-at="2015-12-30T15:55:26Z">
      <reporter-output>
      </reporter-output>
    </test-method> 
    <test-method status="PASS" signature="newProfile()[pri:0,instance:testSuite.DriverScript_Transformation@6fc757]" name="newProfile" duration-ms="818999" started-at="2015-12-30T15:55:26Z" finished-at="2015-12-30T16:09:05Z">
      <reporter-output>
      </reporter-output>
    </test-method>

这是conf文件:

input {
file {
path=>["file-path/testng-result.xml"]
start_position =>"beginning"
type =>suitefile
  }
 }

 filter
 { 
 if[type]=="suitefile"
 {
 xml
 {

 source =>"message"

 remove_namespaces => "true"   


 xpath => ["//test-method/@name","Name",
  "//test-method/@status", "Status"] 
  store_xml => false

    }
 }
}

output {
 stdout { codec => rubydebug}
 elasticsearch_http{
 host => "ip address"   
  }
 }

0 个答案:

没有答案