# \[SOLVED\] Get the real date

**URL:** <https://discuss.elastic.co/t/solved-get-the-real-date/75212>\
**Category:** Logstash\
**Created:** [February 15, 2017, 3:03pm UTC](https://discuss.elastic.co/t/solved-get-the-real-date/75212 "2017-02-15T15:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romain\_PZK](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Romain\_PZK](https://discuss.elastic.co/u/Romain_PZK)\
**Post date:** [February 15, 2017, 3:03pm UTC](https://discuss.elastic.co/t/solved-get-the-real-date/75212/1 "2017-02-15T15:03:00Z")

</div>

Hello,

I have a logstash running well, but I don't understand how to get the real date instead of the timestamp.  
I have read this doc [Date filter plugin | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#_synopsis_116)

The is my config file :

> ```
> input{
> file{
> path => "/home/logs/firewall/*.log"
> type => "linux-syslog"
> #start_position => "beginning"
> }
> }
> 
> ```

> ```
> filter {
> grok {
> match => {
> "message" => '%{SYSLOGTIMESTAMP} %{IPV4:iphost} %{GREEDYDATA:fgtlogmsg}'
> #"message" => '%{SYSLOG5424PRI} %{IPV4:iphost} %{GREEDYDATA:fgtlogmsg}'
> }
> }
> 
> ```

> ```
> kv {
> source => "fgtlogmsg"
> }
> 
> ```

> ```
> mutate {
> remove_field => ["message" , "fgtlogmsg", "vd", "host", "logid", "path", "devid", "devname", "_id", "craction"]
> }
> }
> 
> ```

> ```
> output {
> elasticsearch {
> codec => "json"
> hosts => ["127.0.0.1:9200"]
> index => "heimdall-%{+YYYY.MM.dd}"
> user => "elastic"
> password => "password"
> }
> # stdout { codec => rubydebug }
> }
> 
> ```

And I need to read old syslog file just for one time. How can I do that?

Thanks in advance.

---

<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:** [February 15, 2017, 6:27pm UTC](https://discuss.elastic.co/t/solved-get-the-real-date/75212/2 "2017-02-15T18:27:40Z")

</div>

You need to parse the timestamp part of the syslog message into a field of its own. Then feed that field to the date filter. The syslog example in the documentation should be helpful: [https://www.elastic.co/guide/en/logstash/current/config-examples.html#\_processing\_syslog\_messages](https://www.elastic.co/guide/en/logstash/current/config-examples.html#_processing_syslog_messages)

---

<div class="post-metadata">

**Author:** ![Romain\_PZK](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Romain\_PZK](https://discuss.elastic.co/u/Romain_PZK)\
**Post date:** [February 16, 2017, 10:07am UTC](https://discuss.elastic.co/t/solved-get-the-real-date/75212/3 "2017-02-16T10:07:00Z")

</div>

Hello,

Thanks for your reply.  
Now I have the real syslog date.

> filter {  
> grok {  
> match =\> {  
> "message" =\> '%{SYSLOGTIMESTAMP:timestamp} %{IPV4:iphost} date=%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} time=%{TIME:time} %{GREEDYDATA:fgtlogmsg}'  
> }  
> }  
> date {  
> match =\> ["timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss"]  
> }

---

<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:** [March 16, 2017, 10:07am UTC](https://discuss.elastic.co/t/solved-get-the-real-date/75212/4 "2017-03-16T10:07:07Z")

</div>

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