title: How can I make the Logstash TCP input to separate the messages that it listens on a TCP port?
body: <p>I want to send data to <code>Logstash</code> using the <code>TCP protocol</code>. And to send the data I'm using the <code>Node-RED</code>. A simple configuration for doing that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/rLkdt.png" alt="Sending TCP messages with the Node-RED"></p>
  
  <p>In the <code>Logstash</code> folder, I created a file called <code>nodered.conf</code> with the following content:</p>
  
  <pre><code>input {
      tcp {
          port =&gt; "3999"
      }   
  }
  
  output {
          stdout { codec =&gt; rubydebug }
  }
  </code></pre>
  
  <p>Right now, I just want to print on my screen the information that the <code>Logstash</code> is receiving. That's why I used <code>stdout { codec =&gt; rubydebug }</code> on my output.</p>
  
  <p>So, inside the <code>Logstash</code> folder, I started the <code>Logstash</code> with the following command:</p>
  
  <pre><code>bin/logstash -f nodered.conf --config.reload.automatic
  </code></pre>
  
  <p>The problem is that all the messages that I send to <code>Logstash</code> with the <code>Node-RED</code> are aggregated into a single message. For example, if I inject 5 messages with the <code>Node-RED</code> into my <code>TCP port 3999</code>, after redeploying the <code>Node-RED</code> I receive the following content on my <code>Logstash</code> terminal:</p>
  
  <pre><code>user@computer:/home/Dados/ELK/logstash-5.4.0$ bin/logstash -f nodered.conf --config.reload.automatic
  Sending Logstash's logs to /home/Dados/ELK/logstash-5.4.0/logs which is now configured via log4j2.properties
  [2017-05-29T15:14:52,388][INFO ][logstash.pipeline        ] Starting pipeline {"id"=&gt;"main", "pipeline.workers"=&gt;4, "pipeline.batch.size"=&gt;125, "pipeline.batch.delay"=&gt;5, "pipeline.max_inflight"=&gt;500}
  [2017-05-29T15:14:52,417][INFO ][logstash.inputs.tcp      ] Starting tcp input listener {:address=&gt;"0.0.0.0:3999"}
  [2017-05-29T15:14:52,430][INFO ][logstash.pipeline        ] Pipeline main started
  [2017-05-29T15:14:52,513][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=&gt;9600}
  {
      "@timestamp" =&gt; 2017-05-29T18:19:33.277Z,
            "port" =&gt; 54316,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hellohellohellohellohello"
  }
  </code></pre>
  
  <p>And I actually would like to see something like this without having to redeploy:</p>
  
  <pre><code>user@computer:/home/Dados/ELK/logstash-5.4.0$ bin/logstash -f nodered.conf --config.reload.automatic
  Sending Logstash's logs to /home/Dados/ELK/logstash-5.4.0/logs which is now configured via log4j2.properties
  [2017-05-29T15:27:24,168][INFO ][logstash.pipeline        ] Starting pipeline {"id"=&gt;"main", "pipeline.workers"=&gt;4, "pipeline.batch.size"=&gt;125, "pipeline.batch.delay"=&gt;5, "pipeline.max_inflight"=&gt;500}
  [2017-05-29T15:27:24,191][INFO ][logstash.inputs.tcp      ] Starting tcp input listener {:address=&gt;"0.0.0.0:3999"}
  [2017-05-29T15:27:24,200][INFO ][logstash.pipeline        ] Pipeline main started
  [2017-05-29T15:27:24,260][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=&gt;9600}
  {
      "@timestamp" =&gt; 2017-05-29T18:27:48.394Z,
            "port" =&gt; 54518,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hello"
  }
  {
      "@timestamp" =&gt; 2017-05-29T18:27:51.657Z,
            "port" =&gt; 54546,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hello"
  }
  {
      "@timestamp" =&gt; 2017-05-29T18:27:58.691Z,
            "port" =&gt; 54600,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hello"
  }
  {
      "@timestamp" =&gt; 2017-05-29T18:28:06.330Z,
            "port" =&gt; 54656,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hello"
  }
  {
      "@timestamp" =&gt; 2017-05-29T18:28:14.347Z,
            "port" =&gt; 54682,
        "@version" =&gt; "1",
            "host" =&gt; "127.0.0.1",
         "message" =&gt; "hello"
  }
  </code></pre>
  
  <p>The conclusion is that I don't know how to make the <code>Logstash</code> interpret each message as a unique one instead of concatenating everything that it receives. I've tried using different codecs in my <code>nodered.conf</code> file but I didn't succeed. Does anyone know how can I make the <code>Logstash</code> see every message that it listens on a TCP port as a single one?</p>