Hi,
I have a pattens file which contains diffrent patterns as line by line. I am matching each pattern as follows.
if [tran_type_cd] in ["EMD","EMA","EMC","EMF","EMU","EMX"] {
grok {patterns_dir => ["logstash-7.0.0/schemas/nonrtd/patterns"]
match => { "message" => "%{EMD}" }}}
else if [tran_type_cd] in ["ISG","IPV"]{
grok {patterns_dir => ["logstash-7.0.0/schemas/nonrtd/patterns"]
match => { "message" => "%{ISG}" }}}
else if [tran_type_cd] in ["IEN","IER","MEN","MER","TEN"]{
grok {patterns_dir => ["logstash-7.0.0/schemas/nonrtd/patterns"]
match => { "message" => "%{IEN}" }}}
else if [tran_type_cd] == "IPU"{
grok {patterns_dir => ["logstash-7.0.0/schemas/nonrtd/patterns"]
match => { "message" => "%{IPU}" }}}
I am loading patterns_dir for each else conditions. How can I define patterns_dir as global and match pattern directly. this could avoid defining patterns_dir for each else if conditions.
thanks for reading and hellping.