@timestamp and logstash-output-mongodb


(sampasei) #1

Hi all,
i have a record sent from filebeat and received by logstash: after some filtering (with grock) the record is sent to mongodb.
The problem is linked to @timestamp field:
"@timestamp" : "\"2016-01-26T14:26:49.333Z\""
As you can see, the " are present...how can i remove them?
Thanks


(Magnus Bäck) #2

How are you populating the @timestamp field?


(sampasei) #3

My conf file doesn't modifiy the @timestamp field: the field is sent "untouched" to mongodb


(Magnus Bäck) #4

Does the field come double quoted from Filebeat or are the quotes added somewhere between Logstash's pipeline and MongoDB? Use a stdout { codec => rubydebug } output to inspect what the event look like when it enters the outputs, including mongodb.


(sampasei) #5

Thanks for your reply
i've modified my config file in this way

output {
    mongodb {
      collection => "%{typelog}"
      database => "atest"
      uri => "mongodb://127.0.0.1/"
      codec => "json"
    }
   stdout { codec => rubydebug }
}

And this is the stdout output

{
           "@timestamp" => "2016-01-30T17:12:07.602Z",
     .....
}

I think that this output is correct: this is the same output sent by logstash-output-mongodb plugin to mongodb database?
If so, i have no idea what's wrong...


(Magnus Bäck) #6

If the timestamp strings indeed end up as double quoted in MongoDB it does seem like a bug in the mongodb output.


(system) #7