# Date not working

**URL:** <https://discuss.elastic.co/t/date-not-working/165566>\
**Category:** Logstash\
**Created:** [January 24, 2019, 9:55am UTC](https://discuss.elastic.co/t/date-not-working/165566 "2019-01-24T09:55:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![huangliusong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/huangliusong/32/40204_2.png) [@huangliusong](https://discuss.elastic.co/u/huangliusong)\
**Post date:** [January 24, 2019, 9:55am UTC](https://discuss.elastic.co/t/date-not-working/165566/1 "2019-01-24T09:55:55Z")

</div>

my conf

```
input {
    beats {
        port => "5044"
    }
}
filter {
    dissect {
      mapping => {
        "message" => "%{uat_log_date} %{uat_log_time} %{uat_log_ip} %{uat_log_traid} %{uat_log_action} %{uat_log_flag} %{uat_log_ts1} %{uat_log_ts2} %{uat_log_other}"
      }
       add_field => { "full_date" => "%{uat_log_date} %{uat_log_time}" } 
    }
    mutate {
          # full_date of value is 2019-01-21 09:47:03.641
          gsub => ["full_date", "/", "-"]
    }
    date {
		match => ["full_date", "YYYYMMddHHmmss"]
	}

  }
output {
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "uatlog1-%{+YYYY.MM.dd}"
    }
}

```

I want to convert the full\_date field type to date type using date plugin.

then,The type I query from elasticsearch is text

```
 "full_date" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }

```

What do I need to do to make date plugin to working?

---

<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:** [January 24, 2019, 2:00pm UTC](https://discuss.elastic.co/t/date-not-working/165566/2 "2019-01-24T14:00:01Z")

</div>

> [@huangliusong](#):
>
> ```
> # full_date of value is 2019-01-21 09:47:03.641
> 
> date { match => ["full_date", "YYYYMMddHHmmss"] }
> 
> ```

That date format does not match the format of full\_date. Try

```
date { "match" => ["date", "ISO8601"] }

```

What are you trying to do using the gsub?

---

<div class="post-metadata">

**Author:** ![huangliusong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/huangliusong/32/40204_2.png) [@huangliusong](https://discuss.elastic.co/u/huangliusong)\
**Post date:** [January 25, 2019, 12:39am UTC](https://discuss.elastic.co/t/date-not-working/165566/3 "2019-01-25T00:39:54Z")

</div>

thank you so much!😚

I'd like to transfer 2019/01/21 09:47:03.641 to 2019-01-21 09:47:03.641 using gsub!

---

<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:** [January 25, 2019, 2:12am UTC](https://discuss.elastic.co/t/date-not-working/165566/4 "2019-01-25T02:12:29Z")

</div>

OK, so use

```
    mutate { gsub => ["full_date", "/", "-"] }
    date { "match" => ["full_date", "YYYY-MM-dd HH:mm:ss.SSS"] timezone => "Pacific/Tarawa" }

```

Personally, I wouldn't do it that way.

---

<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:** [February 22, 2019, 2:25am UTC](https://discuss.elastic.co/t/date-not-working/165566/5 "2019-02-22T02:25:59Z")

</div>

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