# Grok skipping on \[ when supplied \\s in a custom filter

**URL:** <https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603>\
**Category:** Logstash\
**Created:** [July 25, 2018, 2:22pm UTC](https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603 "2018-07-25T14:22:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neeraj\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@Neeraj\_Jadhav](https://discuss.elastic.co/u/Neeraj_Jadhav)\
**Post date:** [July 25, 2018, 2:22pm UTC](https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603/1 "2018-07-25T14:22:43Z")

</div>

This is the log that I am trying to parse ==\>

`DESTINATION UNREACHABLE: PORT UNREACHABLE **ORIGINAL DATAGRAM DUMP: 10.8.10.21:28184 -> 10.8.10.19:69 UDP TTL:64 TOS:0x0 ID:40693 IpLen:20 DgmLen:88 Len: 60 Csum: 19270 (60 more bytes of original packet)** END OF DUMP [Xref => http://cve.mitre.org/cgi-bin/cvename.cgi?name=2005-0068][Xref => http://cve.mitre.org/cgi-bin/cvename.cgi?name=2004-0790]`

The Custom Filter that is used ==\>

**(?\<pkt\_detail\>([A-za-z0-9:\*()-.=\>\s])+)%{GREEDYDATA:xrefs}**

The requirement being, separation of Packet Details and XREFS (Starting from **[Xref**). However the Packet Details doesn't stop parsing there and instead this is the output from the debugger:

```
"pkt_detail": [
    [
      "DESTINATION UNREACHABLE: PORT UNREACHABLE **ORIGINAL DATAGRAM DUMP: 10.8.10.21:28184 -> 10.8.10.19:69 UDP TTL:64 TOS:0x0 ID:40693 IpLen:20 DgmLen:88 Len: 60 Csum: 19270 (60 more bytes of original packet)** END OF DUMP [Xref => http:"
    ]
  ],
  "xrefs": [
    [
      "//cve.mitre.org/cgi-bin/cvename.cgi?name=2005-0068][Xref => http://cve.mitre.org/cgi-bin/cvename.cgi?name=2004-0790] "
    ]
  ]

```

Kindly help to stop Packet Detail event after END OF DUMP.

---

<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:** [July 25, 2018, 2:57pm UTC](https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603/2 "2018-07-25T14:57:54Z")

</div>

I would suggest something simpler, such as

```
grok { match => { "message" => "^(?<pkt_detail>[^\[]+)%{GREEDYDATA:xrefs}" } }
```

---

<div class="post-metadata">

**Author:** ![Neeraj\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@Neeraj\_Jadhav](https://discuss.elastic.co/u/Neeraj_Jadhav)\
**Post date:** [July 25, 2018, 3:18pm UTC](https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603/3 "2018-07-25T15:18:47Z")

</div>

Blacklist instead of whitelist. 👍

---

<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:** [August 22, 2018, 3:18pm UTC](https://discuss.elastic.co/t/grok-skipping-on-when-supplied-s-in-a-custom-filter/141603/4 "2018-08-22T15:18:59Z")

</div>

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