Continuing the discussion from How to parse XML using XPATH from SOAP API in Logstash:
in this part we mentioned this question, it was solved with /soapenv:Envelope/soapenv:Body/multiRef/metricValue/text() but in my case it doesn't work
Continuing the discussion from How to parse XML using XPATH from SOAP API in Logstash:
in this part we mentioned this question, it was solved with /soapenv:Envelope/soapenv:Body/multiRef/metricValue/text() but in my case it doesn't work
Please provide an example of your XML and tell us what you have already tried.
I have the next xml.
<not:notificar xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:not1="example">
not1:objetoR
not1:resul02</not1:resul>
not1:date20200603</not1:date>
not1:diag999</not1:diag>
</not1:objetoR>
</not:notificar>
I want parse resul and date.
My logstash is
input {
jdbc {
type => "test"
jdbc_validate_connection => true
jdbc_connection_string => ""
jdbc_user => ""
jdbc_password => ""
jdbc_driver_library => "/"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
statement =>"select campo_xml from test)"
}
}
filter {
if [type] == "test" {
xml{
source => "test"
store_xml => false
force_array => false
xpath => [
"//inot1:objetoR/inot1:resul/text()", "resul",
}
}
}
output {
if [type] == "test" {
stdout{ codec => rubydebug {metadata => true}}
}
}
The thread that you used as an example to solve this doesn't seem helpful to me, as I get the impression that the poster had a problem with attributes with namespaces and “solved” it by querying a completely different field without using those?
Please make sure to use the code formatting option (</>
) to post code because otherwise it's not readable. Why do the names in your xpath begin with inot1
instead of not1
?
Thank you.
The solution I applied was
remove_namespaces => "true"
"//objetoR/resul/text()", "resul"
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.