I am trying to setup filebeat->logstash->elasticsearch chain and I am having problems with @timestamp which is not being transferred from the logfile and a timestamp when the message arrives into logstash is used instead. I will describe it on the example below. I hope somebody will help me understanding this problem and correcting it.
Logfile has this format:
{"application":"MyTestApp","source_host":"apphost01","message":"Hello_World","@timestamp":"2017-02-14T11:38:32.257Z"}
filebeat.yml:
filebeat.prospectors:
- input_type: log
paths:
- /tmp/json.log
output.logstash:
hosts: ["localhost:5043"]
logstash pipeline conf:
input {
beats {
port => "5043"
codec => json
type => "log4j-json"
}
}
output {
stdout { codec => rubydebug }
}
This is the logstash's output: (notice the @timestamp is different than one in the log entry)
{
"source_host" => "apphost01",
"@timestamp" => 2017-02-15T14:47:57.593Z,
"application" => "MyTestApp",
"offset" => 118,
"@version" => "1",
"input_type" => "log",
"beat" => {
"hostname" => "tpl450",
"name" => "tpl450",
"version" => "5.2.1"
},
"host" => "tpl450",
"source" => "/tmp/json.log",
"message" => "Hello_World",
"type" => "log",
"tags" => [
[0] "beats_input_codec_json_applied"
]
}