title: Parsing an array of JSON objects in Logstash
body: <p>I have a log file that's an array of objects that looks something like this:</p>
  
  <pre><code>[
    { "cate1": "data1a", "cate2": "data2a" },
    { "cate1": "data1b", "cate2": "data2b" },
    { "cate1": "data1c", "cate2": "data2c" }
  ]
  </code></pre>
  
  <p>and I need each object in the array to be a separate entry in Elasticsearch and each "cate" to be a field. My current logstash.conf file is:</p>
  
  <pre><code>input {
    tcp {
      port =&gt; 5000
    }
  }
  
  ## Add your filters / logstash plugins configuration here
  
  filter {
    json {
      source =&gt; "message"
      target =&gt; "event"
    }
    mutate {
      gsub =&gt; ["message","\]",""]
      gsub =&gt; ["message","\[",""]
    }
  }
  
  output {
    elasticsearch {
      hosts =&gt; "elasticsearch:9200"
    }
  }
  </code></pre>
  
  <p>but it tags each line with "_jsonparsefailure" except the first entry and it parses the square brackets as well. How would I go about configuring Logstash to do this properly?</p>