I'm trying to parse below XML to get all classname, name,failure and error message. But I'm unable to extract the individual xml elements using the xpath. Can someone point me where am I going wrong?
here is my configuration file to extract classname. But it's not working
input {
file {
path => "/home/jar/Documents/xml/*.xml"
start_position => beginning
codec => multiline
{
pattern => "^<\?testsuite .*\>"
negate => true
what => "previous"
}
}
}
filter {
xml {
source => "src"
target => "testsuite"
xpath =>
[
"//testcase/@classname", "classname"
]
}
if "message" in [tags] {
drop { }
}
date {
match => [ "date" , "dd-MM-yyyy HH:mm:ss" ]
timezone => "Europe/Amsterdam"
}
}
output {
file {
path => "/home/jar/Documents/xml/output2.txt"
}
}
Would be really great if I get some input
<testsuite errors="1" failures="1">
<testcase classname="junit.framework.TestSuite" name="com.webdashboard.Report" time="0.0">
<failure message="Login failed: User labuser"></failure>
</testcase>
<testcase classname="junit.framework.TestSuite" name="com.webdashboard.Report" time="0.002">
<error message="no service found defining interface"> </error>
</testcase>
</testsuite>