# Custom Pattern is not working in Logstash

**URL:** <https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443>\
**Category:** Logstash\
**Created:** [February 26, 2018, 7:27am UTC](https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443 "2018-02-26T07:27:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)\
**Post date:** [February 26, 2018, 7:27am UTC](https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443/1 "2018-02-26T07:27:07Z")

</div>

Hi

i have written custom pattern to match a String in my log file

the pattern is  
\*_REQUEST ^/WebApp\_._ \*\*

my logstash configuration is

> grok{  
> patterns\_dir =\> ["/home/Desktop/patterns"]  
> match =\> {  
> "message" =\> '%{IPORHOST:clientip} %{USER:ident} %{USER:auth} [%{HTTPDATE:logTime}] "%{WORD:method} %{REQUEST} HTTP/%{NUMBER:httpversion}\" %{NUMBER:status} %{QS:referrer} %{QS:agent} %{NUMBER:responseTime}'  
> }
> 
> }

sample log line is

**x.x.x.x - - [26/Feb/2018:05:16:23 +0000] "POST /WebApp\_ID/UserController HTTP/1.1" 200 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64; Trident/7.0; rv:11.0) like Gecko" 11**

when running the above configuration i am getting grockParseFailureException,What mistake i did here?? Please help me

---

<div class="post-metadata">

**Author:** ![rcowart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rcowart/32/88091_2.png) [@rcowart](https://discuss.elastic.co/u/rcowart)\
**Post date:** [February 26, 2018, 8:15am UTC](https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443/2 "2018-02-26T08:15:12Z")

</div>

This pattern works for me...

```auto
%{IPORHOST:clientip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:logTime}\] \"%{WORD:method} %{URIPATH} HTTP/%{NUMBER:httpversion}\" %{NUMBER:status} %{QS:referrer} %{QS:agent} %{NUMBER:responseTime}

```

You forgot to escape the square brackets and the opening quotation mark before the method. I also switched from using your custom REQUEST pattern to using the included URIPATH.

FYI... there is a Grok debugger included in X-Pack basic, or you can use [https://grokdebug.herokuapp.com/](https://grokdebug.herokuapp.com/) They both work the same (and even share a common bug).

Rob

Robert Cowart ([rob@koiossian.com](mailto:rob@koiossian.com))  
[www.koiossian.com](http://www.koiossian.com)  
True Turnkey SOLUTIONS for the Elastic Stack

---

<div class="post-metadata">

**Author:** ![RamyaGowda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramyagowda/32/27440_2.png) [@RamyaGowda](https://discuss.elastic.co/u/RamyaGowda)\
**Post date:** [February 26, 2018, 8:58am UTC](https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443/3 "2018-02-26T08:58:24Z")

</div>

Sorry this is not the solution for me, i want to write my custom pattern and i have to use that in configuration

---

<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:** [March 26, 2018, 8:59am UTC](https://discuss.elastic.co/t/custom-pattern-is-not-working-in-logstash/121443/4 "2018-03-26T08:59:04Z")

</div>

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