Hello,
at the moment I have one event. Console brings the following output:
{
port => [
[0] "22",
[1] "443",
[2] "623",
[3] "0",
[4] "22",
[5] "80"
],
"path" =>"/home/data/test.xml"
"timestamp" => ......
"host-ip" => [
[0] "1.111.11.111"
[1] "1.111.11.112"
[2] "1.111.11.114"
],
}
My aim is to get multiple events with host-ip,path,timestamp and port. For every port i wanna have one ES event. It should looks like this:
{
{
"port" => "22",
"host-ip" => "1.111.11.111",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
},
{
"port" => "443",
"host-ip" => "1.111.11.111",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
},
{
"port" => "623",
"host-ip" => "1.111.11.111",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
},
{
"port" => "0",
"host-ip" => "1.111.11.112",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
},
{
"port" => "22",
"host-ip" => "1.111.11.112",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
},
{
"port" => "80",
"host-ip" => "1.111.11.114",
"timestamp" => ".....",
"path" => "/home/data/test.xml"
}
}
This is my filter
filter {
xml {
target => "doc"
store_xml => "false"
source => "message"
xpath => [
"//Host/tag[@name='host-ip']/text()", "host-ip",
"//ReportItem/@port","Port"
]
}
mutate {
remove_field => ["message", "host", "tags"]
}
}
Can someone help me to achvie my goal? It would be nice if i can do this with a script, because I want to index this with more than one file and number of entries in the host-ip and port field can be different every time.