Configuration with output file and codec not parsed by logstash
<p>I'm trying a "simple" logstash configuration and want to ouput on a file to check. So I took the conf from <a href="https://www.elastic.co/guide/en/logstash/current/plugins-outputs-file.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/logstash/current/plugins-outputs-file.html</a> and put it in my conf:</p>

<pre><code>input {                                                                                                                                                                                                                                   
  file {
    exclude =&gt; ['*.gz']
    path =&gt; ['/var/log/*.log']
    type =&gt; 'system logs'
  }
  syslog {
    port =&gt; 5000
  }
}

output {
  elasticsearch {
    hosts =&gt; ['elasticsearch']
  }

  file {
    path =&gt; "/config/logstash_out.log"
    codec =&gt; {
      line  {
        format =&gt; "message: %{message}"
      }
    }
  }

  stdout {}
}
</code></pre>

<p>but when I launch it (<code>sudo docker run -it --rm  --name logstash -p 514:5000 --link elasticsearch:elasticsearch -v "$PWD":/config logstash logstash -f /config/logstash.conf</code>), I've got a complaint from logstash:</p>

<pre><code>fetched an invalid config 
{:config=&gt;"input {
  file {
    exclude =&gt; ['*.gz']
    path =&gt; ['/var/log/*.log']
    type =&gt; 'system logs'
  }
  syslog {
    port =&gt; 5000
  }
}
output {
  elasticsearch {
    hosts =&gt; ['elasticsearch']
  }

  file {
    path =&gt; \"/config/logstash_out.log\"
    codec =&gt; { 
      line  { 
        format =&gt; \"message: %{message}\"
      }
    }
  }

  stdout {}
}"
, :reason=&gt;"Expected one of #, =&gt; at line 20, column 13 (byte 507) 
after output {  elasticsearch {\n    hosts =&gt; ['elasticsearch']\n  }
\n\n  file {\n    path =&gt; \"/config/logstash_out.log\"\n    
codec =&gt; { \n      line  ", :level=&gt;:error}
</code></pre>

<p>(I've reformatted a bit so it's more readable)</p>

<p>Any ideas why? I'seen <a href="https://stackoverflow.com/questions/29782888/logstash-output-to-file-and-ignores-codec">logstash output to file and ignores codec</a> but the proposed solution is marked as DEPRECATED so I would like to avoid</p>

<p>Thanks!</p>