# How to define custom grock to get only 3 levels deep url

**URL:** <https://discuss.elastic.co/t/how-to-define-custom-grock-to-get-only-3-levels-deep-url/116317>\
**Category:** Logstash\
**Created:** [January 20, 2018, 1:57am UTC](https://discuss.elastic.co/t/how-to-define-custom-grock-to-get-only-3-levels-deep-url/116317 "2018-01-20T01:57:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gokhalep](https://avatars.discourse-cdn.com/v4/letter/g/5f8ce5/32.png) [@gokhalep](https://discuss.elastic.co/u/gokhalep)\
**Post date:** [January 20, 2018, 1:57am UTC](https://discuss.elastic.co/t/how-to-define-custom-grock-to-get-only-3-levels-deep-url/116317/1 "2018-01-20T01:57:04Z")

</div>

Hello I am new to the grocks . I am using a  
%{IPORHOST:clientip} %{USER:ident} %{USER:auth} [%{HTTPDATE:timestamp}] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent}

pattern for my nginx log lines:  
100.20.0.4 - - [09/Jan/2018:09:16:12 +0000] "GET /a/b/c/poll/c? HTTP/1.1" 499 0 "[http://100.18.0.2:8000](http://100.18.0.2:8000)" "ServiceHost/cc557714" 29.585 - .

Now i am trying to use a custom grock pattern to only get /a/b/c for my request symantics.

%{IPORHOST:clientip} %{USER:ident} %{USER:auth} [%{HTTPDATE:timestamp}] "(?:%{WORD:verb} (?\<TEST\_PATTERN\> ^._/\s_)(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent}

However i keep on getting null for the request.

---

<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:** [February 17, 2018, 1:57am UTC](https://discuss.elastic.co/t/how-to-define-custom-grock-to-get-only-3-levels-deep-url/116317/2 "2018-02-17T01:57:15Z")

</div>

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