# Grok filter - access log

**URL:** <https://discuss.elastic.co/t/grok-filter-access-log/172202>\
**Category:** Logstash\
**Created:** [March 13, 2019, 6:42pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202 "2019-03-13T18:42:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kentatoi](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@kentatoi](https://discuss.elastic.co/u/kentatoi)\
**Post date:** [March 13, 2019, 6:42pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202/1 "2019-03-13T18:42:03Z")

</div>

Hi there,

I am trying to apply my grok filter on my access log :

`10.00.000.00 - - [08/Feb/2019:09:06:54 -0500] "GET /bea_wls_test_intern/wl_test HTTP/1.1" 404 1164`

I am trying to apply that :

```
    input { stdin {} }

    filter {
       grok {
         match => { "message" => "%{COMMONAPACHELOG}" }
         OR
         match => ["message", "%{IP:client_ip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:apache_timestamp}\] \"%{WORD:method} /%{NOTSPACE:request_page} HTTP/%{NUMBER:http_version}\" %{NUMBER:server_response} %{NUMBER:bytes}"]
            }
    }

    output { stdout { codec => rubydebug } } 

```

but it doesn't work I have got an error :

`[2019-03-13T14:38:34,887][ERROR][logstash.pipeline] Error registering plugin {:pipeline_id=>"id", :plugin=>"#<LogStash::FilterDelegator:0x70116fa>", :error=>"end pattern with unmatched parenthesis:`

Do you have an idea ?  
Thank you

---

<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:** [March 13, 2019, 6:51pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202/2 "2019-03-13T18:51:15Z")

</div>

> [@kentatoi](#):
>
> match =\> { "message" =\> "%{COMMONAPACHELOG}" } OR match =\> ["message", "%{IP:client\_ip} %{USER:ident} %{USER:auth} [%{HTTPDATE:apache\_timestamp}] "%{WORD:method} /%{NOTSPACE:request\_page} HTTP/%{NUMBER:http\_version}" %{NUMBER:server\_response} %{NUMBER:bytes}"] }

You cannot use OR like that. Try

```
grok { match => { "message" => ["^%{COMMONAPACHELOG}"] } }

```

---

<div class="post-metadata">

**Author:** ![kentatoi](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@kentatoi](https://discuss.elastic.co/u/kentatoi)\
**Post date:** [March 13, 2019, 7:00pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202/3 "2019-03-13T19:00:45Z")

</div>

It is the two filters that I tried .. I did not put OR for real ! I tried your suggestion but it doesn't work either . I tested my filter on the grok constructor it is supposed to work ...

---

<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:** [March 13, 2019, 7:40pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202/4 "2019-03-13T19:40:27Z")

</div>

I tested both of your grok patterns and they both match the example line you gave.

"end pattern with unmatched parenthesis" would be caused by something like

```
    grok { match => { "message" => ["^%(COMMONAPACHELOG}"] } }

```

or even just

```
grok { match => { "message" => ["("] } }
```

---

<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 10, 2019, 7:40pm UTC](https://discuss.elastic.co/t/grok-filter-access-log/172202/5 "2019-04-10T19:40:32Z")

</div>

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