# How to convert my time with the date filter for kibana

**URL:** https://discuss.elastic.co/t/how-to-convert-my-time-with-the-date-filter-for-kibana/239579
**Category:** Logstash
**Created:** [July 2, 2020, 7:20am UTC](https://discuss.elastic.co/t/how-to-convert-my-time-with-the-date-filter-for-kibana/239579 "2020-07-02T07:20:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mathis\_Gourc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mathis_gourc/32/71514_2.png) [@Mathis\_Gourc](https://discuss.elastic.co/u/Mathis_Gourc)
#### Post date: [July 2, 2020, 7:20am UTC](https://discuss.elastic.co/t/how-to-convert-my-time-with-the-date-filter-for-kibana/239579/1 "2020-07-02T07:20:00Z")

</div>

I need to exploit this log line:

```auto
30361 30485 494 8861012 42:42 /plw/modules/bin/Lx86_64/opx2-intranet.exe -I /plw/modules/bin/Lx86_64/opx2-intranet.dxl -H /plw/modules/bin/Lx86_64 -L /plw/PLW_PROD/modules/preload-intranet.ini -- plw-sysconsole -port 8400 -logdir /plw/PLW_PROD/httpdocs/admin/log/ -slaves 2

```

My goal is to recover the time it took the system to boot up, here 42:42. The problem is that the format can be mm:ss as here, or HH:mm:ss for example, 01:42:30. I'd like to know which paterne grok to use. Here's my conf file :

```auto
input {
    file { 
        path => ["/home/mathis/Documents/*]"
        start_position => "beginning"
        sincedb_path => "/dev/null"
    }
}

filter {
    grok {
        match => {"message" => ["%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}%{TIME:starttime}"]}
        remove_field => "message"
    }
    date {
            match => ["starttime", "HH:mm:ss","mm:ss"]
    }
}
output {
    elasticsearch {
        hosts => "127.0.0.1:9200"
        index => "logstash-local3-%{+YYYY.MM.dd}"
    }
}

```

Unfortunately, the syntax of TIME is HH:mm:ss and does not include mm:ss.

---

<div class="post-metadata">

### Author: ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)
#### Post date: [July 2, 2020, 8:06am UTC](https://discuss.elastic.co/t/how-to-convert-my-time-with-the-date-filter-for-kibana/239579/2 "2020-07-02T08:06:52Z")

</div>

Try this: The last part is the original [time pattern](https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns) just with optional hours.

`%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}%{NUMBER}%{SPACE}(?<starttime>((?!<[0-9])%{HOUR}:)?%{MINUTE}(?::%{SECOND})(?![0-9]))`

---

<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: [July 30, 2020, 8:13am UTC](https://discuss.elastic.co/t/how-to-convert-my-time-with-the-date-filter-for-kibana/239579/4 "2020-07-30T08:13:42Z")

</div>

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