# Logstash 1.5.x grok regex multiline behavior change?

**URL:** <https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347>\
**Category:** Logstash\
**Created:** [November 11, 2015, 6:56pm UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347 "2015-11-11T18:56:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitsofinfo/32/459_2.png) [@bitsofinfo](https://discuss.elastic.co/u/bitsofinfo)\
**Post date:** [November 11, 2015, 6:56pm UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347/1 "2015-11-11T18:56:34Z")

</div>

Hi,

Currently upgrading from 1.4.1 to 1.5.4

This filter works fine in 1.4.x : [https://github.com/bitsofinfo/logstash-modsecurity/blob/master/logstash-modsecurity.conf](https://github.com/bitsofinfo/logstash-modsecurity/blob/master/logstash-modsecurity.conf)

When I run it in 1.5.4 it "sort of" works. There seem to be issues around how ".+" matches newlines in logstash 1.5.x.

Before I go to far off into the weeds here, I am curious. **What changed in the regex/grok engine from 1.4.1 to 1.5.4 that would result in a default change in how grok patterns interpret ".+" when it comes to matching new lines?**

Here is a basic example:

RAW DATA:

```
GET /etc/passwd HTTP/1.1
User-Agent: Wget/1.15 (darwin13.1.0)
Accept: */*
Host: my.host
Connection: Keep-Alive

```

GROK:

```
grok {
    match => {
             "message" => "%{DATA:httpMethod}\s(?<requestedUri>\S+)\s(?<incomingProtocol>.+)\n{1}"
    }
}

```

EXPECTED (3 fields) (and this is what I get with logstash 1.4.1)

**httpMethod** = GET  
**requestedUri** = /etc/passwd  
**incomingProtocol** = HTTP/1.1

1.5.4 RESULT (incomingProtocol contains more data that it should)

**httpMethod** = GET  
**requestedUri** = /etc/passwd

**incomingProtocol**  
HTTP/1.1  
User-Agent: Wget/1.15 (darwin13.1.0)  
Accept: _/_  
Host: my.host  
Connection: Keep-Alive

---

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitsofinfo/32/459_2.png) [@bitsofinfo](https://discuss.elastic.co/u/bitsofinfo)\
**Post date:** [November 11, 2015, 8:24pm UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347/2 "2015-11-11T20:24:48Z")

</div>

Note it appears that logstash 1.5.4 grok is matching newlines when I do ".+", but if i do ".+?" i only get the 1st line... shouldn't this be off by default?

---

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitsofinfo/32/459_2.png) [@bitsofinfo](https://discuss.elastic.co/u/bitsofinfo)\
**Post date:** [November 12, 2015, 3:11pm UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347/3 "2015-11-12T15:11:00Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitsofinfo/32/459_2.png) [@bitsofinfo](https://discuss.elastic.co/u/bitsofinfo)\
**Post date:** [November 18, 2015, 6:00pm UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347/4 "2015-11-18T18:00:29Z")

</div>

anyone?

---

<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:** [July 6, 2017, 5:22am UTC](https://discuss.elastic.co/t/logstash-1-5-x-grok-regex-multiline-behavior-change/34347/5 "2017-07-06T05:22:19Z")

</div>

Closed on July 6, 2017, 5:22am UTC


