Hello Everyone,
I'm unable to dissect my xml file. I'm getting some error of "error"=>{"type"=>"illegal_argument_exception", "reason"=>"mapper [CELL] cannot be changed from type [text] to [ObjectMapper]"}
. Please find below my .conf file
input
{
file
{
path => "/home/admin/*_CSSR.xml"
codec => multiline
{
pattern => "^<moid*>"
negate => "true"
what => "previous"
}
}
}
filter
{
xml
{
source => "message"
store_xml => true
target => "parsed"
}
dissect { mapping =>
{
"message" => '<moid>%{BSC}/GCELL:LABEL=%{CELL}, CellIndex=%{CellIndex}, CGI=%{CGI}</moid>
<r>%{CELL.ASS.SUCC.RATE}</r>
<r>%{CELL.BSS.CALL.ESTB.SUCC.RATE}</r>
<r>%{CELL.CALL.ESTB.SUCC.RATE}</r>
<r>%{CELL.ESTB.IND.SUCC.RATE.IMM.ASS}</r>
<r>%{CELL.SD.CALL.DROP}</r>
%{?lereste}<mv>' }
}
}
Here is the errors messages:
[WARN ] 2022-09-05 16:39:10.714 [[main]>worker7] elasticsearch - Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"xml-05-09-2022", :routing=>nil}, {"BSC"=>"BSC04_KANKAN", "CELL"=>"MAN22471D", "CGI"=>"611019C44608A", "CELL.BSS.CALL.ESTB.SUCC.RATE"=>"98.031", "CELL.ASS.SUCC.RATE"=>"100", "tags"=>["multiline", "_xmlparsefailure"], "log"=>{"file"=>{"path"=>"/home/admin/HOST04_pmresult_60_202209051500_202209051600_CSSR.xml"}}, "host"=>{"name"=>"ogn-poc-uat-aiml-cam"}, "message"=>"<moid>BSC04_KANKAN/GCELL:LABEL=MAN22471D, CellIndex=449, CGI=611019C44608A</moid>\n<r>100</r>\n<r>98.031</r>\n<r>92.857</r>\n<r>98.031</r>\n<r>0</r>\n<sf>false</sf>\n</mv>\n<mv>", "@timestamp"=>2022-09-05T16:39:09.689004Z, "event"=>{"original"=>"<moid>BSC04_KANKAN/GCELL:LABEL=MAN22471D, CellIndex=449, CGI=611019C44608A</moid>\n<r>100</r>\n<r>98.031</r>\n<r>92.857</r>\n<r>98.031</r>\n<r>0</r>\n<sf>false</sf>\n</mv>\n<mv>"}, "@version"=>"1", "CELL.CALL.ESTB.SUCC.RATE"=>"92.857", "CELL.ESTB.IND.SUCC.RATE.IMM.ASS"=>"98.031", "CELL.SD.CALL.DROP"=>"0", "CellIndex"=>"449"}], :response=>{"index"=>{"_index"=>"xml-05-09-2022", "_id"=>"gM-FDoMB5KKfgEMDJsEl", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"mapper [CELL] cannot be changed from type [text] to [ObjectMapper]"}}}}
[WARN ] 2022-09-05 16:39:11.853 [[main]>worker5] xml - Error parsing xml with XmlSimple {:source=>"message", :value=>"<moid>BSC04_KANKAN/GCELL:LABEL=KER22464A, CellIndex=262, CGI=611019C4A6041</moid>\n<r>100</r>\n<r>98.305</r>\n<r>91.304</r>\n<r>98.305</r>\n<r>0</r>\n<sf>false</sf>\n</mv>\n</mi>\n</md>\n<mff>\n<ts>202209051600</ts>\n</mff>\n</mdc>", :exception=>#<REXML::ParseException: #<RuntimeError: attempted adding second root element to document>
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:197:in `add'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb:1931:in `add'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb:22:in `initialize'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb:14:in `initialize'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb:328:in `initialize'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb:1929:in `add'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb:733:in `add_element'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:210:in `add_element'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb:34:in `parse'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:448:in `build'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:101:in `initialize'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:979:in `parse'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:164:in `xml_in'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:203:in `xml_in'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-xml-4.1.3/lib/logstash/filters/xml.rb:195:in `filter'
/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:159:in `do_filter'
/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:178:in `block in multi_filter'
org/jruby/RubyArray.java:1821:in `each'
/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:175:in `multi_filter'
org/logstash/config/ir/compiler/AbstractFilterDelegatorExt.java:134:in `multi_filter'
/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:300:in `block in start_workers'
...
attempted adding second root element to document
Line: 2
Position: 85
Last 80 unconsumed characters:
>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb:96:in `parse'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:448:in `build'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb:101:in `initialize'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:979:in `parse'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:164:in `xml_in'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/xml-simple-1.1.9/lib/xmlsimple.rb:203:in `xml_in'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-xml-4.1.3/lib/logstash/filters/xml.rb:195:in `filter'", "/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:159:in `do_filter'", "/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:178:in `block in multi_filter'", "org/jruby/RubyArray.java:1821:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/filters/base.rb:175:in `multi_filter'", "org/logstash/config/ir/compiler/AbstractFilterDelegatorExt.java:134:in `multi_filter'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:300:in `block in start_workers'"]}
Because the pattern is repeated (as it is xml file), I see the ParseException
, saying : #<RuntimeError: attempted adding second root element to document>
.
I don't know how to fix this issue.
Your help is really appreciate.
Thanks in advance.