Hi,
I am trying to send data from python script over TCP and receive the same in the logstash.
But there is no exchange of data happening.
logstash.conf
input {
tcp {
port => 5959
codec => json
}
}
filter{
}
output {
stdout {codec => rubydebug}
}
python :
import socket
import json
import sys
HOST = "127.0.0.1"
PORT = 5959
print "#STARTED#"
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "socket created. sock: " + str(sock)
except socket.error, msg:
print "error"
sys.stderr.write("[ERROR] %s\n" % msg[1])
sys.exit(1)
try:
sock.connect((HOST, PORT))
print "socket connected to HOST: "+HOST+" PORT: "+str(PORT)
print "socket connected. sock: " + str(sock)
except socket.error, msg:
print "error"
sys.stderr.write("[ERROR] %s\n" % msg[1])
sys.exit(2)
msg = {'@message': 'python test message', '@tags': ['python', 'test']}
print "sending message: " + str(msg)
sock.sendall(json.dumps(msg))
print "end"
sock.close()
sys.exit(0)
After executing both the srcipts I am neither getting any error nor data in the logstash so can someone help like what can be causing the issue.