title: How to parse json in logstash /grok from a text file line?
body: <p>I have a logfile which looks like this ( simplified)</p>
  
  <p><strong>Logline sample</strong></p>
  
  <pre><code>MyLine data={"firstname":"bob","lastname":"the builder"}
  </code></pre>
  
  <p>I'd like to extract the json contained in <strong>data</strong> and create two fields, one for firstname, one for last. However, the ouput i get is this:</p>
  
  <pre><code>{"message":"Line data={\"firstname\":\"bob\",\"lastname\":\"the builder\"}\r","@version":"1","@timestamp":"2015-11-26T11:38:56.700Z","host":"xxx","path":"C:/logstashold/bin/input.txt","MyWord":"Line","parsedJson":{"firstname":"bob","lastname":"the builder"}}
  </code></pre>
  
  <p>As you can see</p>
  
  <pre><code>..."parsedJson":{"firstname":"bob","lastname":"the builder"}}
  </code></pre>
  
  <p>That's not what I need, I need to create fields for firstname and lastname in kibana, but logstash isn't extracting the fields out with the json filter.</p>
  
  <p><strong>LogStash Config</strong></p>
  
  <pre><code>input {
    file {
          path =&gt; "C:/logstashold/bin/input.txt"        
         }
  }
  
  filter {     
  
     grok {
              match =&gt; { "message" =&gt; "%{WORD:MyWord} data=%{GREEDYDATA:request}"}        
          }   
  
      json{
          source =&gt; "request"
          target =&gt; "parsedJson"
          remove_field=&gt;["request"]
      }   
  }   
  
  output {  
      file{
          path =&gt; "C:/logstashold/bin/output.txt"
      }   
  }
  </code></pre>
  
  <p>Any help greatly appreciated, I'm sure I'm missing out something simple</p>
  
  <p>Thanks</p>