Can we Create dynamic xpath in logstash

Here is my xml file

My input:

input {
file {
path => "D:/SampleELK/input.xml"
start_position => "beginning"
sincedb_path => "NUL"
codec => multiline {
pattern => "^"
negate => true
what => "previous"
multiline_tag => "multi_tagged"
auto_flush_interval => 1
}
}
}
filter {
xml {
source => "message"
target => "parsed"
store_xml => "false"
xpath => [
"NetReport/@datetime", "date_time",
"NetReport/Net/@managedClientID", "cid" ,
"/NetReport/Net/category[@name='Software']/item[@name='Software Application']//property[@name='Name']/text()", "Pname",
"/NetReport/Net/category[@name='Software']/item[@name='Software Application']//property[@name='Caption']/text()", "Caption",
]
}
}
output{
stdout { codec => rubydebug }
}

So, my question is, in xpath, i want to pass dynamic values for @name='Software' or @name='PC Core' or @name='xyz',..... and repeat the xpath to give more dynamic values as my xml has many lines of code. Is this possible?
Ex:-
/NetReport/Net/category[@name='Software']/
/NetReport/Net/category[@name='PC Core']/
/NetReport/Net/category[@name='xyz']/
......
......

Please help me as i have very long xml file and cannot mention all of them in the xpath. Thanks in advance

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