# How to replace @timestamp to the log files mentioned date?

**URL:** <https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306>\
**Category:** Logstash\
**Created:** [March 14, 2019, 10:11am UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306 "2019-03-14T10:11:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kharishma](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@Kharishma](https://discuss.elastic.co/u/Kharishma)\
**Post date:** [March 14, 2019, 10:11am UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/1 "2019-03-14T10:11:53Z")

</div>

Hi,  
i have attached the configuration file. Can please help me out to copy the LOGTIME to @timestamp.

input {  
beats {  
port =\> 5044  
}  
}  
filter {  
grok{  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|%{WORD:PROCESS}\s+%{NUMBER:DURATION:float}\s+%{WORD:UNIT}"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|[%{WORD:PROCESS}]\s+%{NUMBER:DURATION:float}\s+%{WORD:UNIT}"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|(?%{WORD} %{WORD} %{WORD})\s+:\s+%{NUMBER:DURATION:float}\s+%{WORD:UNIT}"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|[%{WORD:PROCESS}]"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|\<%{WORD:PROCESS}\>"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|\<%{WORD:PROCESS}\>\s+%{NUMBER:DURATION:float}\s+%{WORD:UNIT}"}  
match =\> {"message" =\> "%{TIMESTAMP\_ISO8601:LOGTIME}|%{WORD:LOGLEVEL}|%{WORD:MACHINE}|%{WORD:PROCESSID}|%{WORD:SERVICENAME}|%{GREEDYDATA:MSG}"}  
}  
date {  
match =\> ["LOGTIME","ISO8601"]  
target =\> "@timestamp"  
}  
}  
output {  
elasticsearch{  
hosts =\> "localhost:9200"  
manage\_template =\> false  
index =\> "finallog"  
document\_type =\> "test"  
}  
stdout{codec=\>rubydebug}  
}

 ![image.png](https://us1.discourse-cdn.com/elastic/original/3X/6/5/654d819cd5fd8979af61e88a3442d9144bcb6b25.png)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 14, 2019, 12:47pm UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/3 "2019-03-14T12:47:19Z")

</div>

```
date { match => ["LOGTIME", "YYYY-MM-dd HH:mm:ss"] }
```

---

<div class="post-metadata">

**Author:** ![Kharishma](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@Kharishma](https://discuss.elastic.co/u/Kharishma)\
**Post date:** [March 14, 2019, 12:49pm UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/4 "2019-03-14T12:49:49Z")

</div>

I tried it but the datatype isn't changed to date. Its still string only..

The value of the @timestamp dnt change to my LOGTIME value..

---

<div class="post-metadata">

**Author:** ![A\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/a_b/32/17104_2.png) [@A\_B](https://discuss.elastic.co/u/A_B)\
**Post date:** [March 14, 2019, 12:51pm UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/5 "2019-03-14T12:51:41Z")

</div>

`LOGTIME` will stay as _string_ but @timestamp should now be equal to the date of `LOGTIME`.

---

<div class="post-metadata">

**Author:** ![Kharishma](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@Kharishma](https://discuss.elastic.co/u/Kharishma)\
**Post date:** [March 14, 2019, 12:53pm UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/6 "2019-03-14T12:53:28Z")

</div>

Yeah I got it...  
It has changed...  
Thank you....

---

<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:** [April 11, 2019, 12:53pm UTC](https://discuss.elastic.co/t/how-to-replace-timestamp-to-the-log-files-mentioned-date/172306/7 "2019-04-11T12:53:28Z")

</div>

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