title: Using JSON with LogStash
body: <p>I'm going out of my mind here. I have an app that writes logs to a file. Each log entry is a JSON object. An example of my .json file looks like the following:</p>
  <pre><code>{&quot;Property 1&quot;:&quot;value A&quot;,&quot;Property 2&quot;:&quot;value B&quot;}
  {&quot;Property 1&quot;:&quot;value x&quot;,&quot;Property 2&quot;:&quot;value y&quot;}
  </code></pre>
  <p>I'm trying desperately to get the log entries into LogStash. In an attempt to do this, I've created the following LogStash configuration file:</p>
  <pre><code>input {
    file {
      type =&gt; &quot;json&quot;
      path =&gt; &quot;/logs/mylogs.log&quot;
      codec =&gt; &quot;json&quot;
    }
  }
  output {
    file {
      path =&gt; &quot;/logs/out.log&quot;
    }
  }
  </code></pre>
  <p>Right now, I'm manually adding records to mylogs.log to try and get it working. However, they appear oddly in the stdout. When I look open out.log, I see something like the following:</p>
  <pre><code>{&quot;message&quot;:&quot;\&quot;Property 1\&quot;:\&quot;value A\&quot;, \&quot;Property 2\&quot;:\&quot;value B\&quot;}&quot;,&quot;@version&quot;:&quot;1&quot;,&quot;@timestamp&quot;:&quot;2014-04-08T15:33:07.519Z&quot;,&quot;type&quot;:&quot;json&quot;,&quot;host&quot;:&quot;ip-[myAddress]&quot;,&quot;path&quot;:&quot;/logs/mylogs.log&quot;}
  </code></pre>
  <p>Because of this, if I send the message to ElasticSearch, I don't get the fields. Instead I get a jumbled mess. I need my properties to still be properties. I do not want them crammed into the message portion or the output. I have a hunch this has something to do with Codecs. Yet, I'm not sure. I'm not sure if I should change the codec on the logstash input configuration. Or, if I should change the input on the output configuration.</p>