# Load custom grok patterns at startup

**URL:** <https://discuss.elastic.co/t/load-custom-grok-patterns-at-startup/124121>\
**Category:** Logstash\
**Created:** [March 15, 2018, 2:58pm UTC](https://discuss.elastic.co/t/load-custom-grok-patterns-at-startup/124121 "2018-03-15T14:58:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfseth](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pfseth](https://discuss.elastic.co/u/pfseth)\
**Post date:** [March 15, 2018, 2:58pm UTC](https://discuss.elastic.co/t/load-custom-grok-patterns-at-startup/124121/1 "2018-03-15T14:58:33Z")

</div>

Is it possible to load custom grok patterns at the startup of logstash ?

i would like to avoid loading grok filters each time

> filter {  
> grok {  
> patterns\_dir =\> "/etc/logstash/grok/"  
> match =\> { "message" =\> "%{CALL}" }  
> add\_field =\> { "[@metadata][pattern]" =\> "parsed" }  
> tag\_on\_failure =\> [call\_parse\_error]  
> }  
> if "call-in" in [message] {  
> csv { separator =\> "|"  
> columns =\> ["timestamp","id","call\_type","plan\_id","bill\_id","caller","callee"]  
> add\_field =\> { "[@metadata][csv]" =\> "matched" } }  
> }  
> else if "call-out" in [message] {  
> csv { separator =\> "|"  
> columns =\> ["timestamp","id","call\_type","plan\_id","bill\_id","caller","callee"]  
> add\_field =\> { "[@metadata][csv]" =\> "matched" } }  
> }
> 
> grok {  
> patterns\_dir =\> "/etc/logstash/grok/"  
> match =\> { "message" =\> "%{MSG}" }  
> add\_field =\> { "[@metadata][pattern]" =\> "parsed" }  
> tag\_on\_failure =\> [msg\_parse\_error]  
> }  
> if "sms-in" in [message] {  
> csv { separator =\> "|"  
> columns =\> ["timestamp","id","msg\_type","plan\_id","bill\_id","Anumber","Bnumber"]  
> add\_field =\> { "[@metadata][csv]" =\> "matched" } }  
> }  
> else if "sms-out" in [message] {  
> csv { separator =\> "|"  
> columns =\> ["timestamp","id","msg\_type","plan\_id","bill\_id","Anumber","Bnumber"]  
> add\_field =\> { "[@metadata][csv]" =\> "matched" } }
> 
> }
> 
> }

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [March 15, 2018, 7:31pm UTC](https://discuss.elastic.co/t/load-custom-grok-patterns-at-startup/124121/2 "2018-03-15T19:31:18Z")

</div>

No; there is no way to set a global configuration that affects all instances of a plugin.

---

<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 12, 2018, 7:31pm UTC](https://discuss.elastic.co/t/load-custom-grok-patterns-at-startup/124121/3 "2018-04-12T19:31:24Z")

</div>

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