# Grok timestamp (can't match pattern)

**URL:** <https://discuss.elastic.co/t/grok-timestamp-cant-match-pattern/263816>\
**Category:** Logstash\
**Created:** [February 10, 2021, 12:24am UTC](https://discuss.elastic.co/t/grok-timestamp-cant-match-pattern/263816 "2021-02-10T00:24:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frankie\_Braybon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankie_braybon/32/83681_2.png) [@Frankie\_Braybon](https://discuss.elastic.co/u/Frankie_Braybon)\
**Post date:** [February 10, 2021, 12:24am UTC](https://discuss.elastic.co/t/grok-timestamp-cant-match-pattern/263816/1 "2021-02-10T00:24:02Z")

</div>

The log line I am trying to make patterns on:  
Sent from filebeat to logstash.

[Log Level- [1],[2021-01-05 15:19:28:410 GMT+0000], Thread ID: -858872064 HEALTH CHECK STATUS : 0, HealthCheck/Src/HealthCheckManager.cpp, 90

My logstash beats config:

```auto
filter {

        if "filebeat" in [tags] {

                grok {

                        patterns_dir => "/etc/logstash/patterns.txt"

                        match => [

                        "message", "\[Log Level- \[%{NUMBER:log-level}\],",

# "message", ",\[%{EVENTTIME:logtimestamp}"

# "message", ",\[%{LOGTIMESTAMP:logtimestamp}"

                        "message", ",\[%{TIMESTAMP_ISO8601:logtimestamp}"

                        ]

                }

        }

}

```

Patterns\_dir/patterns.txt

```auto
LOGTIMESTAMP %{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND}

EVENTTIME %{YEAR}[-]%{MONTHNUM}[-]%{MONTHDAY}[]%{HOUR}[:]%{MINUTE}[:]%{SECOND}

```

I am trying to create the field "logtimestamp", but I've been unable to match the timestamp against TIMESTAMP\_ISO8601 or the custom pattern I created in patterns.txt.

Is my pattern incorrect?

---

<div class="post-metadata">

**Author:** ![Cad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cad/32/86661_2.png) [@Cad](https://discuss.elastic.co/u/Cad)\
**Post date:** [February 15, 2021, 8:35pm UTC](https://discuss.elastic.co/t/grok-timestamp-cant-match-pattern/263816/2 "2021-02-15T20:35:24Z")

</div>

Hi,  
I think you synthaxe try to match multiple patterns against a single field.  
In your case you want to have the log info **and** the timestamp.  
So your grok filter should be like this:

```auto
filter {
    grok {
        match => {
            "message" => "\[Log Level- \[%{NUMBER:log-level}\],\[%{TIMESTAMP_ISO8601:logtimestamp}"
        }
    }
}

```

To check if you grok configuration work you have a debugger on kibana or you can use this [site](https://grokdebug.herokuapp.com/)

Cad.

---

<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 15, 2021, 8:35pm UTC](https://discuss.elastic.co/t/grok-timestamp-cant-match-pattern/263816/3 "2021-03-15T20:35:42Z")

</div>

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