# Timestamp =\> @timestamp

**URL:** https://discuss.elastic.co/t/timestamp-timestamp/85763
**Category:** Logstash
**Created:** [May 15, 2017, 12:36pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763 "2017-05-15T12:36:24Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 15, 2017, 12:36pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/1 "2017-05-15T12:36:24Z")

</div>

Hi ,  
I have specific log in a file log:  
`Tue May 2 03:54:22 2017`

I use a grok filter to extract the timestamp into a field of its own called "datestamp"  
`"datestamp" => "Tue May 2 03:57:00 2017 ", "@timestamp" => 2017-05-15T14:25:05.490Z,`  
My filter here ,  
`{filter { date { match => ["datestamp" , "yyyy-MM-dd'T'HH:mm:ss.SSSZ"] target => "@timestamp" } }`  
i know how to replace the @timestamp by datestamp, but it doesn't work (dateparsefailure). I think it's my match , because the date format is not that , right ?

---

<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: [May 15, 2017, 12:39pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/2 "2017-05-15T12:39:11Z")

</div>

Correct. Your date pattern doesn't even resemble what your timestamp actually looks like. Note that the date filter logs what it's having trouble with.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 15, 2017, 1:07pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/4 "2017-05-15T13:07:43Z")

</div>

Okay thanks,  
What date format can match here ?  
Where can i find the date filter logs ?

---

<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: [May 15, 2017, 1:40pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/5 "2017-05-15T13:40:46Z")

</div>

> What date format can match here ?

The date filter documentation lists which tokens are available. "EEE MMM d HH:mm:ss YYYY" and "EEE MMM dd HH:mm:ss YYYY" should work in your case.

> Where can i find the date filter logs ?

In the Logstash log file, typically found in /var/log/logstash.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 15, 2017, 1:57pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/6 "2017-05-15T13:57:15Z")

</div>

It doesn't work ☹ , dateparsefailure again  
Where can i find date filter logs for test file, because I test this file with logstash-f, so it doesn't write  
in/ var/log/logstash...

---

<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: [May 15, 2017, 2:25pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/7 "2017-05-15T14:25:56Z")

</div>

> Where can i find date filter logs for test file, because I test this file with logstash-f, so it doesn't write  
> in/ var/log/logstash...

In that case Logstash should dump the logs to stdout.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 15, 2017, 3:01pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/8 "2017-05-15T15:01:06Z")

</div>

> [@magnusbaeck](#):
>
> In that case Logstash should dump the logs to stdout.

It just said "\_dateparsefailure

---

<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: [May 15, 2017, 6:10pm UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/9 "2017-05-15T18:10:42Z")

</div>

I'm pretty sure it said a lot more than that. To save everyone's time, please copy/paste the command you're running and the full output you get.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 17, 2017, 6:54am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/10 "2017-05-17T06:54:32Z")

</div>

So , my output test of run.conf file;

> `output { stdout { codec => rubydebug {} } } `

For test it, I run this

> `/usr/share/logstash/bin/logstash -f run.conf`

My date filter currently:

```
 date {
   match => ["datestamp" , "EEE MMM d HH:mm:ss YYYY"]
   target => "@timestamp"
 }

```

And my output ;

> {  
> "path" =\> "/var/log/saprouterlog/saprouterlog.txt\_a\_20170502\_035422- 20170502\_072722",  
> "datestamp" =\> "Tue May 2 03:59:22 2017 ",  
> "@timestamp" =\> 2017-05-17T08:50:03.584Z,  
> "@version" =\> "1",  
> "host" =\> "elkf",  
> "sap\_session" =\> "C106/-",  
> "message" =\> "Tue May 2 03:59:22 2017 CONNECT FROM C106/- 172.16.58.19 9/22502",  
> "type" =\> "saplog",  
> "sap\_action" =\> "CONNECT FROM ",  
> "sap\_ipsource" =\> "172.16.58.199",  
> "tags" =\> [  
> [0] "saprouter1",  
> [1] "\_dateparsefailure",  
> [2] "connect from"  
> ],  
> "sap\_port" =\> "/22502"  
> }  
> ^C10:50:04.721 [SIGINT handler] WARN logstash.runner - SIGINT received. Shuttin g down the agent.  
> 10:50:04.795 [LogStash::Runner] WARN logstash.agent - stopping pipeline {:id=\>" main"}  
> ^C10:50:04.889 [SIGINT handler] FATAL logstash.runner - SIGINT received. Termina ting immediately..

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [May 17, 2017, 7:12am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/11 "2017-05-17T07:12:00Z")

</div>

It looks like you have a trailing space in the `datestamp` field, which is not accounted for in the pattern. Correct the pattern used to extract this field and I do not see why it would not work.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 17, 2017, 7:27am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/12 "2017-05-17T07:27:27Z")

</div>

Thanks for your reply, but I try that with 1 more space between MMM and d and it didnt works.

> date {  
> match =\> ["datestamp" , "EEE MMM d HH:mm:ss YYYY"]  
> target =\> "@timestamp"  
> }

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [May 17, 2017, 7:28am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/13 "2017-05-17T07:28:55Z")

</div>

I am referring to the space at the end off the string.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 17, 2017, 7:38am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/14 "2017-05-17T07:38:52Z")

</div>

Okay , it didnt work but it dont said me \_dateparsefailure

> {  
> "path" =\> "/var/log/saprouterlog/saprouterlog.txt\_a\_20170510\_060630-20170510\_102448",  
> "datestamp" =\> "Wed May 10 06:12:51 2017 ",  
> "@timestamp" =\> 2017-05-10T04:12:51.000Z,  
> "@version" =\> "1",  
> "host" =\> "elkf",  
> "sap\_session" =\> "C300/-",  
> "message" =\> "Wed May 10 06:12:51 2017 CONNECT FROM C300/- 172.16.58.199/55352",  
> "type" =\> "saplog",  
> "sap\_action" =\> "CONNECT FROM ",  
> "sap\_ipsource" =\> "172.16.58.199",  
> "tags" =\> [  
> [0] "saprouter1",  
> [1] "connect from"  
> ],  
> "sap\_port" =\> "/55352"

My filter date after add the space:

> ```
> date {
> match => ["datestamp","EEE MMM d HH:mm:ss YYYY "]
> target => "@timestamp"
> }
> 
> ```
> 
> }  
> }

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [May 17, 2017, 7:40am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/15 "2017-05-17T07:40:28Z")

</div>

That seems to work. Remember that `@timestamp` is always in UTC. Instead of adding the space to the date filter pattern, I would recommend modifying the extraction pattern to get rid of it instead.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 17, 2017, 7:43am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/16 "2017-05-17T07:43:12Z")

</div>

Ah yes , i forgot it 🙂  
We can change UTC right ?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [May 17, 2017, 7:44am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/17 "2017-05-17T07:44:55Z")

</div>

Timestamps in Elasticsearch are assumed to be in UTC, and a lot of functionality, including Kibana, relies on this. Trying to change this is therefore to ask for trouble.

---

<div class="post-metadata">

### Author: ![Saplog](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Saplog](https://discuss.elastic.co/u/Saplog)
#### Post date: [May 17, 2017, 7:45am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/18 "2017-05-17T07:45:58Z")

</div>

Ok, Thank you very much for your help Christian and thanks magnus for your great help 🙂

---

<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: [June 14, 2017, 7:46am UTC](https://discuss.elastic.co/t/timestamp-timestamp/85763/19 "2017-06-14T07:46:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
