logstash接受checkpoint防火墙日志并用ruby分词
作者:互联网
直接上logstahs配置文件
input{
syslog{
type => "syslog"
port => 514
}
}
filter {
grok {
match => {
"message" => "\[%{DATA:log}\"\]"
}
}
ruby {
code => "
array1 = event.get('log').split(%r{\";\s})
array1.each do |temp1|
if temp1.nil? then
next
end
array2 = temp1.split(':')
key = array2[0]
value = array2[1]
if key.nil? then
next
end
event.set(key, value)
end
"
remove_field => [ "log" ]
}
}
output {
elasticsearch {
hosts => "elastic:9200"
user => "elastic"
password => "*****"
index => "smc-%{+yyyy.MM.dd}"
}
}
标签:end,log,array2,event,checkpoint,temp1,key,ruby,logstash 来源: https://www.cnblogs.com/obitoma/p/14898293.html