title: Grok pattern for different types of log in a logfile
body: <p>I am trying to write grok pattern for my log file which has three different types of logs, I want to put a filter on the type names (TYPE1,TYPE2,TYPE3) and then write three different grok patterns for this one log file.
  Also, my log file is a csv separated file.</p>
  
  <p>Log file:<br>
  TYPE1,word,word,word,num<br>
  TYPE2,word,word,word,word<br>
  TYPE3,num,word,num,word  </p>
  
  <p>Here's what I have tried so far:</p>
  
  <pre><code>filter {
  if [message] =~ /TYPE1/ {
  grok {
      match =&gt; [ "message", "%{WORD:type},%{WORD:a1"},%{WORD:a2"},%{WORD:a3"},%{POSINT:a4"}]
       }
     }
  }
  </code></pre>
  
  <p>This doesn't work.
  Also, in this config file i have written grok patterns for other files (which are working well) like: </p>
  
  <pre><code>filter {
      if [type] == "sometype1" or [type] == "sometype2" {
      grok {
      match =&gt; [ "message",  "%{POSINT:moduleid}%{SPACE}%{NUMBER:date}"]
           }
        }
     }
  </code></pre>
  
  <p>And the logfile which is giving me problem has type=sometype3 which I have not mentioned anywhere. </p>
  
  <p>Thanks</p>