xpath - How can I use several xml filter for one xml message -
i have parse xml document (received rabbitmq message) want more info according filters. here xml part of logstash
if ([message] =~ /^</) { xml { ... xpath => [ "/apios_mom_event/ident/no_emiarte/text()", "no_emiarte", "name(/apios_mom_event/data/apios_export/*[not(self::metadata)])","message_type", "name(/apios_mom_event/data/*)","recommendations", "/apios_mom_event/data/apios_export/metadata/code_offre_web/text()","offre_web" ] target => "xml" } alter { condrewrite => [ "message_type","","edito" ] condrewriteother => [ "recommendations","recommendations","message_type","recommendations" ] condrewriteother => [ "recommendations","schedule","message_type","schedule" ] remove_field => [ "recommendations" ] } if [message_type]=="schedule" { xml{ source => "message" store_xml => false xpath => [ "/apios_mom_event/data/schedule/day/@date","day" ] target => "xml" } } }
so here if have schedule message_type add filter day seems quite complex so. have feeling message_type not available in if statement
it's until if [message_type]=="schedule" {
ok, don't know why wasn't working code below works well
... remove_field => [ "recommendations" ] } if [message_type]=="schedule" { xml{ source => "message" store_xml => false xpath => [ "/apios_mom_event/data/schedule/day/@date","day", "/apios_mom_event/data/schedule/day/element/no_emiarte/text()","no_emiarte", "/apios_mom_event/data/schedule/day/element/id_prog/text()","id_prog" ] target => "xml" } }
the new fields fulfilled in es.
Comments
Post a Comment