I'm searching if in logstash exist a xpath function like the one in PHP to get the child of a node without knowing the name.
Thanks to everyone
I'm searching if in logstash exist a xpath function like the one in PHP to get the child of a node without knowing the name.
Thanks to everyone
"without knowing the name" -- the name of the parent or the name of the child? Anyways, if you start with
input { generator { count => 1 lines => [ '<e1><e2><a /><b>foo</b><c>bar<d>baz</d></c></e2></e1>' ] } }
and use an xml filter
xml {
source => "message"
store_xml => false
xpath => {
"/*/*/*/node()" => "children"
}
}
then you will get
"children" => [
[0] "foo",
[1] "bar",
[2] "<d>baz</d>"
],
"/*/*/*/text()"
will result in
"children" => [
[0] "foo",
[1] "bar"
],
"/*/*/*"
will result in
"children" => [
[0] "<a/>",
[1] "<b>foo</b>",
[2] "<c>bar<d>baz</d></c>"
],
It is unclear what you are asking for since you have not explained what the PHP children function does.
Thanks Badger!
Yes i mean the name of the child.
I think the one i need is the node().
Thank you i try it later
Worked like i need it! Thank you!
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.