I have the following below kind of json present with me to be dumped in elastic search using filebeat {"@timestamp":"2017-02-10T06:30:51.424Z","beat":{"hostname":"myhostname","name":"mydevice-logger","version":"5.2.0"},"fields":{"device_type":"mydevice","env":"staging"},"metricset":{"module":"system","name":"cpu","rtt":211},"system":{"cpu":{"cores":4,"idle":{"pct":0.000000},"iowait":{"pct":0.000000},"irq":{"pct":0.000000},"nice":{"pct":0.000000},"softirq":{"pct":0.000000},"steal":{"pct":0.000000},"system":{"pct":0.000000},"user":{"pct":0.000000}}},"tags":["automata","box"],"type":"metricbeat-test-log"}
my logstash( version 5.1.1) config contains, input, filter and output like below -
input {
beats {
port => 5046
codec => json
}
}
filter {
if ...{}
else if [type] == "metricbeat-test-log" {
date {
match => ["@timestamp", "ISO8601"]
}
}
}
}
output {
if ...{}
else if [type] == "metricbeat-test-log" {
stdout { codec => rubydebug }
}
}
The type is right however the date filter is not working . The @timestamp
finally takes current timestamp always . I want to replace it with original @timestamp
present in json.