# Parsing thread number in grok

**URL:** <https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743>\
**Category:** Logstash\
**Created:** [May 31, 2017, 1:16pm UTC](https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743 "2017-05-31T13:16:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanza54](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zanza54/32/17955_2.png) [@zanza54](https://discuss.elastic.co/u/zanza54)\
**Post date:** [May 31, 2017, 1:16pm UTC](https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743/1 "2017-05-31T13:16:27Z")

</div>

Hi

I'm trying to parse a logline in grok but I can't get past the thread number in my log lines.

Example logline:

```auto
428 31/05/2017 08:11:53.243	T[63] INFO Service.Internal.ReturnUserType INTERNAL\test_cf --+End of method

```

My grok till this issue

```auto
%{NUMBER:linenumber} (?<datestamp>%{MONTHDAY}/%{MONTHNUM}/%{YEAR} %{TIME}) 

```

I tried for example `(?<thread>T[%{NUMBER}])` but this doesn't work.

What am I doing wrong? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![zanza54](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zanza54/32/17955_2.png) [@zanza54](https://discuss.elastic.co/u/zanza54)\
**Post date:** [May 31, 2017, 1:27pm UTC](https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743/2 "2017-05-31T13:27:23Z")

</div>

Found the solution. I had to escape the brackets.  
So the following grok fixed it for me:  
`(?<thread>T\[%{NUMBER}\])`

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [May 31, 2017, 1:27pm UTC](https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743/3 "2017-05-31T13:27:46Z")

</div>

I suppose `[` and `]` is a special charater, jsut escape it.

---

<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:** [June 28, 2017, 1:27pm UTC](https://discuss.elastic.co/t/parsing-thread-number-in-grok/87743/4 "2017-06-28T13:27:54Z")

</div>

Closed on June 28, 2017, 1:27pm UTC

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