Sending data to Logstash TCP

So I have logstash configured like this:

input:
  tcp {
    port => 5401
  }

output: 
	stdout { 
		codec => rubydebug 
	}

When I try to connect to the port via browser, I can see the connection incoming in logstash logs. However when I try to send data to it via a python script I can see that the script runs but no data is incoming.
This is the Python script:

import socket
import sys

HOST = '<My-IP>'
PORT = 5401

try:
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error as msg:
  sys.stderr.write("[ERROR] %s\n" % msg[1])
  sys.exit(1)

try:
  sock.connect((HOST, PORT))
except socket.error as msg:
  sys.stderr.write("[ERROR] %s\n" % msg[1])
  sys.exit(2)

msg = "test123"

sock.send(msg.encode('utf-8') )

sock.close()
sys.exit(0)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.