# Convert logstash date sting

**URL:** <https://discuss.elastic.co/t/convert-logstash-date-sting/145039>\
**Category:** Logstash\
**Created:** [August 19, 2018, 8:38am UTC](https://discuss.elastic.co/t/convert-logstash-date-sting/145039 "2018-08-19T08:38:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charaf\_Ahmed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charaf_ahmed/32/30467_2.png) [@Charaf\_Ahmed](https://discuss.elastic.co/u/Charaf_Ahmed)\
**Post date:** [August 19, 2018, 8:38am UTC](https://discuss.elastic.co/t/convert-logstash-date-sting/145039/1 "2018-08-19T08:38:23Z")

</div>

Hello,

I am not blocked on a problem of conversion of string in date timestamp.  
Indeed, I have a filebeat that reads a json file already made and sends it to logstaash. and at the logstash level, I wanted to convert the timestamp field to date so that it takes into account the date of the log and not the indexing date of the data in the database.

here is the output of logstash :

```
   "full_log" => "Aug 1 02:02:15 xxxx sshd[12571]: Failed password for root from 1.1.1.1 port 3 ssh2",
    "predecoder" => {
           "timestamp" => "Aug 1 02:02:15",
        "program_name" => "sshd",
            "hostname" => "xxxxx"
    },
        "offset" => 3,
    "@timestamp" => 2018-08-19T08:24:26.705Z 
    }

```

The changes I made at the logstash level did not do anything

```
date{
	match => ["timeestamp", "YYYY-MM-dd HH:mm:ss", "YYYY/MM/dd HH:mm:ss +0200"]
	target => "@timestamp_new"
	timezone => "UTC"
}

```

What should I change to solve my problem? Thank you

---

<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:** [August 19, 2018, 2:19pm UTC](https://discuss.elastic.co/t/convert-logstash-date-sting/145039/2 "2018-08-19T14:19:44Z")

</div>

Are you trying to parse [precoder][timestamp]?

---

<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:** [September 16, 2018, 2:19pm UTC](https://discuss.elastic.co/t/convert-logstash-date-sting/145039/3 "2018-09-16T14:19:50Z")

</div>

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