Filebeat is sending xml files to logstash.
input {
beats {
port => "5044"
}
}
filter {
## interpret the message as XML
if [type] == "nessus-report" {
xml {
source => "message"
store_xml => false
xpath =>[
"/NessusClientData_v2/Report/@name","report_name",
"/NessusClientData_v2/Report/ReportHost","report_host"
]
}
split {
field => "report_host"
}
xml {
source => "report_host"
store_xml => false
xpath =>[
"/ReportHost/ReportItem","report_item",
"/ReportHost/@name","report_host_name",
"/ReportHost/HostProperties/tag[@name='HOST_START']/text()","report_host_start",
"/ReportHost/HostProperties/tag[@name='HOST_END']/text()","report_host_end"
]
}
split {
field => "report_item"
}
xml {
source => "report_item"
store_xml => false
xpath =>
[
"/ReportItem/@port","report_item_port"
]
}
mutate {
remove_field => [ "message","report_host","report_item" ]
replace => { "report_host_start" => "%{report_host_start[0]}" }
replace => { "report_host_end" => "%{report_host_end[0]}" }
convert => { "report_item_severity" => "integer" }
}
date {
match => [ "report_host_start", "EEE MMM dd HH:mm:ss yyyy" ]
target => "report_host_start"
locale => "en_US"
}
date {
match => [ "report_host_end", "EEE MMM dd HH:mm:ss yyyy" ]
target => "report_host_end"
locale => "en_US"
}
}
}
output {
if [type]=="nessus-report" {
elasticsearch {
hosts => ["10.99.40.16:9200"]
manage_template => false
index => "nessus-report-%{report_name}-%{+YYYY.MM.dd}"
document_type => "nessus-report"
}
}
}
I'm trying to insert field report_name into index but the result is:
_index= nessus-report-2017-04-24
type = %{[@metadata][type]}
report_name = correct-name
can someone help me?
tnks !!