# Parse date field

**URL:** https://discuss.elastic.co/t/parse-date-field/369294
**Category:** Logstash
**Created:** [October 23, 2024, 4:34pm UTC](https://discuss.elastic.co/t/parse-date-field/369294 "2024-10-23T16:34:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lemospt](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@lemospt](https://discuss.elastic.co/u/lemospt)
#### Post date: [October 23, 2024, 4:34pm UTC](https://discuss.elastic.co/t/parse-date-field/369294/1 "2024-10-23T16:34:51Z")

</div>

Hi guys,

i'm injecting data from an oracle database with jdbc plugin. But i'm having trouble parsing date from a field.  
Below is a data example,

```auto
{
                  "data" => 2024-10-22T16:07:54Z,
        "transaction_id" => "a3767673-2087-4bb4-a103-91c6f845bf82",
                  "tipo" => nil,
       "cotacao_cliente" => 0.0,
                    "id" => 2297.0,
                  "opex" => 0.0,
             "bandwidth" => 0.0,
           "observacoes" => "Some random text here",
              "concelho" => nil,
              "@version" => "1",
          "cotacao_rede" => 0.0,
              "services" => "L3",
                  "tags" => [
        [0] "_dateparsefailure"
    ],
    "distancia_total_fo" => nil,
          "anel_metroet" => nil,
            "@timestamp" => 2024-10-23T16:27:00.371297Z,
                  "ptr2" => nil,
      "opex_equivalente" => 0.0,
                  "zona" => nil,
         "cotacao_total" => 0.0
}

```

The field i want to parse is "data" =\> 2024-10-22T16:07:54Z

i'm trying the following,

```auto
date {
	  match => ["data", "ISO8601", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss'Z'"]
	} 

```

but always get dateparsefailure.

Anyone can help understand what is wrong?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [October 23, 2024, 4:46pm UTC](https://discuss.elastic.co/t/parse-date-field/369294/2 "2024-10-23T16:46:46Z")

</div>

Hello,

From what you shared the `data` field is already a date type field in Logstash, so there is no need to parse it.

I do not use the `jdbc` plugin or input, but if I'm not wrong it will convert any date field into a date type in Logstash, you wouldn't need to use the `date` filter.

---

<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: [October 23, 2024, 6:54pm UTC](https://discuss.elastic.co/t/parse-date-field/369294/3 "2024-10-23T18:54:43Z")

</div>

> [@lemospt](#):
>
> ` "data" => 2024-10-22T16:07:54Z,`

As Leandro says, the jdbc input has already parsed the date for you. You can tell that in the rubydebug output because the value does not have quotes around it.

---

<div class="post-metadata">

### Author: ![lemospt](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@lemospt](https://discuss.elastic.co/u/lemospt)
#### Post date: [October 24, 2024, 1:04pm UTC](https://discuss.elastic.co/t/parse-date-field/369294/4 "2024-10-24T13:04:43Z")

</div>

that's it @leandrojmp and @Badger. In fact i didn't recognize that 'data' field is already a date type.  
JDBC input plugin already set field type for every fields.

Thanks a lot for your help.
