这个错误会在启动logstash后偶尔出来;重启logstash后;重新过滤日志就会恢复正常。ruby错误消失;
请问这个是没把ruby环境加载进来嘛?
原始日志格式
2018-06-05T14:44:38.954048+08:00 94050 [Note] Aborted connection 94050 to db: 'information_schema' user: 'telemonitor' host: '134.108.1.19' (Got an error reading communication packets)
2018-06-05T14:44:41.296781+08:00 0 [ERROR] /apps01/teledb/mysql6606/bin/mysqld: Got an error reading communication packets
2018-06-05T14:44:41.307480+08:00 0 [ERROR] /apps01/teledb/mysql6606/bin/mysqld: Got an error reading communication packets
2018-06-05T14:44:53.909580+08:00 94071 [Note] Aborted connection 94071 to db: 'information_schema' user: 'telemonitor' host: '134.108.1.19' (Got an error reading communication packets)
过滤条件:空格隔开后将第三块定义为alarm_level;带上前面的日志时间
#过滤MySQL日志
dissect{
mapping => {
"message"=>"%{log_time}+%{} %{} %{alarm_level} %{}"
}
}
mutate {
gsub=> ["alarm_level","[\[\]]",""]
}
ruby{
code => 'event.set("time",(Time.parse(event.get("log_time"))))'
}
ruby{
code => 'event.set("time",event.get("time")+8*60*60)'
}
过滤时虽然ruby没错但是老是出现ruby错误;请求老师如何用ruby脚本写