# Logstash Custom Patterns is not not working

**URL:** <https://discuss.elastic.co/t/logstash-custom-patterns-is-not-not-working/161242>\
**Category:** Logstash\
**Created:** [December 18, 2018, 5:49am UTC](https://discuss.elastic.co/t/logstash-custom-patterns-is-not-not-working/161242 "2018-12-18T05:49:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surya\_Vamsi\_Pappu](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@Surya\_Vamsi\_Pappu](https://discuss.elastic.co/u/Surya_Vamsi_Pappu)\
**Post date:** [December 18, 2018, 5:49am UTC](https://discuss.elastic.co/t/logstash-custom-patterns-is-not-not-working/161242/1 "2018-12-18T05:49:02Z")

</div>

I have defined the following grok filter :

filter{  
if[message] !~ ".\*sub-page-type=[-a-zA-Z0-9\_]+"  
{  
drop{}  
}  
else  
{  
patterns\_dir =\> ["{env path}/patternCustom"]  
match =\>{  
"message" =\> ".\*StartTime=%{NUMBER:StartTime}.\*MarketplaceId=%{MARKETPLACE\_ID:MarketplaceId}.\*Session=%{SESSION:Session}.\*CustomerId=%{CUSTOMER\_ID:CustomerId}.\*StatusCode=%{NUMBER:StatusCode}.\*sub-page-type=%{SUB\_PAGE\_TYPE:SubPageType}"  
}  
}  
}  
}

and the custom pattern file is as follows

MARKETPLACE\_ID [0-9A-Za-z]\*  
SESSION [0-9-]\*  
CUSTOMER\_ID [0-9A-Za-z]+  
SUB\_PAGE\_TYPE [-a-zA-Z0-9\_]+

I'm not able to find the error in this , because in the logstash.log im getting pattern not defined error.

any help would be appreciated.

---

<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:** [January 15, 2019, 5:49am UTC](https://discuss.elastic.co/t/logstash-custom-patterns-is-not-not-working/161242/2 "2019-01-15T05:49:10Z")

</div>

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