public

tcp_rvice_syslog-ng.py

  • Download Gist
tcp server listen syslog-ng port
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import os
import sys
import SocketServer
import threading
 
class ThreadedEchoRequestHandler(SocketServer.StreamRequestHandler):
 
def handle(self):
self.data = self.rfile.readline().strip()
print self.data
return
 
 
class ThreadedEchoServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pass
 
if __name__ == "__main__":
host,port="0.0.0.0",5144
HOST,PORT = host,port
server = ThreadedEchoServer((host,port), ThreadedEchoRequestHandler)
#server = SocketServer.TCPServer((HOST, PORT), ThreadedEchoRequestHandler)
server.serve_forever()

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.