# How not to output a matching field in grok pattern?

**URL:** <https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435>\
**Category:** Logstash\
**Created:** [August 18, 2020, 1:50pm UTC](https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435 "2020-08-18T13:50:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tristan\_D](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tristan_d/32/73492_2.png) [@Tristan\_D](https://discuss.elastic.co/u/Tristan_D)\
**Post date:** [August 18, 2020, 1:50pm UTC](https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435/1 "2020-08-18T13:50:18Z")

</div>

I don't want the mathed http\_version field in the output. How should I to do avoid it?  
I can't remove it with the non-caputering group symbol.

This is my nginx log  
`10.102.136.44 - - [26/Nov/2019:19:49:36 +0800] "POST /recognize/task_timer HTTP/1.1" 200`

The grok pattern  
`%{IPORHOST:remote_addr} - %{USERNAME:remote_user} \[%{HTTPDATE:timelocal}\] "%{WORD:request_method} %{DATA:request} (?:%{DATA:http_version})"`

Here is the result of [Grok Debugger](https://grokdebug.herokuapp.com/)

```auto
{
  "remote_addr": [
    "10.102.136.44"
  ],
  "remote_user": [
    "-"
  ],
  "timelocal": [
    "26/Nov/2019:19:49:36 +0800"
  ],
  "request_method": [
    "POST"
  ],
  "request": [
    "/recognize/task_timer"
  ],
  "http_version": [
    "HTTP/1.1"
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)\
**Post date:** [August 18, 2020, 2:05pm UTC](https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435/2 "2020-08-18T14:05:25Z")

</div>

If you don't name the field, it won't be there (– just `%{DATA}`).

---

<div class="post-metadata">

**Author:** ![Tristan\_D](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tristan_d/32/73492_2.png) [@Tristan\_D](https://discuss.elastic.co/u/Tristan_D)\
**Post date:** [August 19, 2020, 1:25am UTC](https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435/3 "2020-08-19T01:25:28Z")

</div>

Thank you for your replying. It solved my problem.

---

<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:** [September 16, 2020, 1:25am UTC](https://discuss.elastic.co/t/how-not-to-output-a-matching-field-in-grok-pattern/245435/4 "2020-09-16T01:25:29Z")

</div>

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