# Logstash grok

**URL:** https://discuss.elastic.co/t/logstash-grok/262498
**Category:** Logstash
**Created:** [January 28, 2021, 12:40pm UTC](https://discuss.elastic.co/t/logstash-grok/262498 "2021-01-28T12:40:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![igormarqs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igormarqs/32/17678_2.png) [@igormarqs](https://discuss.elastic.co/u/igormarqs)
#### Post date: [January 28, 2021, 12:40pm UTC](https://discuss.elastic.co/t/logstash-grok/262498/1 "2021-01-28T12:40:13Z")

</div>

hey all;

I have this log line:

`TID: [] [] [2021-01-28 12:25:50,298] INFO {org.wso2.carbon.databridge.core.DataBridge} - user admin connected {org.wso2.carbon.databridge.core.DataBridge}`

and i use this grok:

`TID: \[] \[] \[%{TIMESTAMP_ISO8601:time}]%{SPACE}%{LOGLEVEL:logLevel} {%{JAVACLASS:class}} -%{SPACE}%{GREEDYDATA:logMessage}`

the result is:

```auto
{
  "logLevel": "INFO",
  "logMessage": "user admin connected {org.wso2.carbon.databridge.core.DataBridge}",
  "time": "2021-01-28 12:25:50,298",
  "class": "org.wso2.carbon.databridge.core.DataBridge"
}

```

but sometimes that line log can be like this:

`TID: [-1234] [] [2021-01-28 12:25:50,298] INFO {org.wso2.carbon.databridge.core.DataBridge} - user admin connected {org.wso2.carbon.databridge.core.DataBridge}`

how can i ignore the 2 first `[]` and what they have inside? to me the only important thing is since the timestamp.

i appreciate any help.

---

<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 28, 2021, 5:23pm UTC](https://discuss.elastic.co/t/logstash-grok/262498/2 "2021-01-28T17:23:20Z")

</div>

Change your pattern to `"TID: \[%{DATA}] \[] ...` which will match zero or more characters inside the square brackets.

---

<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 25, 2021, 5:23pm UTC](https://discuss.elastic.co/t/logstash-grok/262498/3 "2021-02-25T17:23:21Z")

</div>

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