Elasticsearch 1.7.1
Logstash 1.5.4
I use below syslog's logstash config. When i run logstash,error occurred.
***"logstash ruby exception occurred undefined method localtime"***. How can i fix it?
configuration file for Logstash + syslog, called logstash-syslog.conf.
input {
tcp {
port => 5000
type => syslog
}
udp {
port => 5000
type => syslog
}
}
filter {
ruby {
code => "
event['@timestamp'] = event['@timestamp'].localtime('+09:00')
"
}
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:[%{POSINT:syslog_pid}])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
elasticsearch { host => localhost }
stdout { codec => rubydebug }
}