Logstash multiline codec with xml filter

Hello Everyone i have a input xml file, that i am using to send to elasticsearch.
i want all fields within and . However i am getting below error. pls suggest.

Input file

2020-09-30 11:59:54,755 (Test worker) JobScheduler INFO: Start scheduling jobs: 2
2020-09-30 11:59:54,755 (Test worker) JobScheduler INFO: Job 1 is not qualified for cloud
2020-09-30 11:59:54,755 (Test worker) JobScheduler INFO: Scheduling results: 1 out of 2 is assigned


0.02
2020-09-30T18:59:54
0.02




0.005
com.amobee.scheduler.SchedulerTest
testJobComparator
false
0

This is the config file im using

[root@app861.sjc2.turn.com ~]# cat /etc/logstash/conf.d/jenkins-ciatl1-test.conf
input {
file {
#path => "/home/ashivaramakrishnan/junitResult-test.xml"
path => "/home/ashivaramakrishnan/junitResult.xml"
start_position => "beginning"
codec => multiline {

We assume every line starting with starts with 8 spaces, so lines with > 8 space, or first non-whitespace is </.., or doesn't have xml tag (to

catch some wrapped strings in stack trace), are attached to previous line

#pattern => "(^\s{9,}<\w+>)|(^\s*</)|(^\s*[\w])"
#pattern => "^(\s+)(^\s*</)|(^\s*[\w])"
#pattern => "(^\s*<case+.)"
pattern => "^<?case .
>"
negate => "true"
what => "previous"
auto_flush_interval => 5
}
}
}

filter {
xml {
store_xml => false
source => "message"
target => "xml_content"
#remove_namespaces => true
xpath =>
[
"/case/testName/text()", "testcaseName",
"/case/className/text()", "className",
"/case/errorStackTrace/text()", "errorStackTrace"
]
remove_field => "message"
}

#if ![errorStackTrace] or ![className] or ![testcaseName] {

drop { }

#}

if "_grokparsefailure" in [tags] {
drop {}
}

}

output {
stdout {
codec => rubydebug {
}
}

I want output to be something like below. But getting max lines reached error.

"testcaseName" => [
[0] "testJobComparator"
],
"tags" => [
[0] "multiline",
[1] "multiline_codec_max_lines_reached"
],
"@version" => "1",
"host" => "app861.sjc2.turn.com",
"className" => [
[0] "com.amobee.scheduler.SchedulerTest"
],
"path" => "/home/ashivaramakrishnan/junitResult.xml"

Please format your post to make it readable. Select your log file entries and click on </> in the toolbar above the edit pane. Then do the same for the configuration.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.