# Logstash grok not working

**URL:** <https://discuss.elastic.co/t/logstash-grok-not-working/125416>\
**Category:** Logstash\
**Created:** [March 23, 2018, 10:26pm UTC](https://discuss.elastic.co/t/logstash-grok-not-working/125416 "2018-03-23T22:26:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benoit\_Martin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benoit_martin/32/21235_2.png) [@Benoit\_Martin](https://discuss.elastic.co/u/Benoit_Martin)\
**Post date:** [March 23, 2018, 10:26pm UTC](https://discuss.elastic.co/t/logstash-grok-not-working/125416/1 "2018-03-23T22:26:53Z")

</div>

Hi,

I try to use regex syntax with grok/match. I don't have any error and the match not working.  
Anything wrong here ???

```auto
grok {
  match => { "[event_data][param2]" => "(?<adfs_userid>(?<=\<UserId\>)(.*)(?=\<\/UserId\>))" }
}

```

I use another match in the same if to make sure my condition is ok.

Thank you in advance!!!

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [March 24, 2018, 7:44am UTC](https://discuss.elastic.co/t/logstash-grok-not-working/125416/2 "2018-03-24T07:44:45Z")

</div>

> [@Benoit\_Martin](#):
>
> (?\<adfs\_userid\>(?\<=&lt;UserId&gt;)(.\*)(?=&lt;/UserId&gt;))

Hm. It definitely looks like it should match using the [Grok Constructor](http://grokconstructor.appspot.com/do/match), but is not matching in Logstash.

I think it may have to do with the lookahead- and lookbehind assertions; I can capture with the following though:

```auto
grok {
  match => { "[event_data][param2]" => "<UserId>(?<adfs_userid>(.*))</UserId>" }
}

```

---

<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:** [April 21, 2018, 7:44am UTC](https://discuss.elastic.co/t/logstash-grok-not-working/125416/3 "2018-04-21T07:44:51Z")

</div>

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