# @timestamp and logstash-output-mongodb

**URL:** <https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129>\
**Category:** Logstash\
**Created:** [January 26, 2016, 2:56pm UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129 "2016-01-26T14:56:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sampasei](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sampasei](https://discuss.elastic.co/u/sampasei)\
**Post date:** [January 26, 2016, 2:57pm UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/1 "2016-01-26T14:57:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 28, 2016, 7:25am UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/2 "2016-01-28T07:25:28Z")

</div>

How are you populating the `@timestamp` field?

---

<div class="post-metadata">

**Author:** ![sampasei](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sampasei](https://discuss.elastic.co/u/sampasei)\
**Post date:** [January 28, 2016, 8:50am UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/3 "2016-01-28T08:50:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 28, 2016, 6:00pm UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/4 "2016-01-28T18:00:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sampasei](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sampasei](https://discuss.elastic.co/u/sampasei)\
**Post date:** [January 30, 2016, 5:18pm UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/5 "2016-01-30T17:18:11Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 30, 2016, 7:19pm UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/6 "2016-01-30T19:19:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:13am UTC](https://discuss.elastic.co/t/timestamp-and-logstash-output-mongodb/40129/7 "2017-07-06T05:13:39Z")

</div>

Closed on July 6, 2017, 5:13am UTC


