# Problem in grok pattern

**URL:** <https://discuss.elastic.co/t/problem-in-grok-pattern/83552>\
**Category:** Logstash\
**Created:** [April 25, 2017, 11:02am UTC](https://discuss.elastic.co/t/problem-in-grok-pattern/83552 "2017-04-25T11:02:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahimsharaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibrahimsharaf/32/17304_2.png) [@ibrahimsharaf](https://discuss.elastic.co/u/ibrahimsharaf)\
**Post date:** [April 25, 2017, 11:02am UTC](https://discuss.elastic.co/t/problem-in-grok-pattern/83552/1 "2017-04-25T11:02:19Z")

</div>

Hello, I have this snippet of a log-file

```
2017-01-01 07:53:44 [connectionpool.py] DEBUG: "POST /api/v1/crawledproducts/merchant/ariika/new_crawl_iteration/ HTTP/1.1" 200 None
2017-01-01 07:53:44 [monitor_utils.py] INFO: Crawled iteration for merchant ariika started
2017-01-01 07:53:44 [utils.py] INFO: UpdateCrawlIteration._start_crawl_iteration function took 0.127 s
2017-01-01 07:53:44 [telnet.py] DEBUG: Telnet console listening on 127.0.0.1:33357
2017-01-01 07:53:44 [middlewares.py] INFO: [kipp] Using user agent (Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17)

```

I wrote a grok filter to extract the merchant name (ariika) from the second line, I tested it on grok debugger it was working, but it didn't extract in logstash

```
grok{
	match => ["message", "(?<merchant_name>(?<=Crawled iteration for merchant ).*(?= started))"]
}

```

Can you suggest a better pattern?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 25, 2017, 12:23pm UTC](https://discuss.elastic.co/t/problem-in-grok-pattern/83552/2 "2017-04-25T12:23:45Z")

</div>

The lookbehind assertion (or whatever it is) seems like an overcomplication. Why not this?

```
Crawled iteration for merchant %{WORD:merchant} started
```

---

<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:** [May 23, 2017, 12:29pm UTC](https://discuss.elastic.co/t/problem-in-grok-pattern/83552/3 "2017-05-23T12:29:08Z")

</div>

Closed on May 23, 2017, 12:29pm UTC

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