[Twisted-Python] Syslog Listener UDP
Hi, I would like to build a syslog(udp port 514) listener in twisted. The goal is to make it compatible with syslog and syslog-ng, which may be configured on a "client" to send log entries (as they occur) via udp (fire and forget) to a remote server (my twisted server). Is there already something out there that would do this or that would be a good start? Thanks, Marc
Hi, Is this going to be an open source project? Best, Nicolas On Sun, Sep 28, 2008 at 8:18 PM, Marc Byrd <dr.marc.byrd@gmail.com> wrote:
Hi,
I would like to build a syslog(udp port 514) listener in twisted. The goal is to make it compatible with syslog and syslog-ng, which may be configured on a "client" to send log entries (as they occur) via udp (fire and forget) to a remote server (my twisted server).
Is there already something out there that would do this or that would be a good start?
Thanks,
Marc
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- A+ Nico http://www.deviant-abstraction.net
OoO Pendant le journal télévisé du dimanche 28 septembre 2008, vers 20:18, "Marc Byrd" <dr.marc.byrd@gmail.com> disait :
I would like to build a syslog(udp port 514) listener in twisted. The goal is to make it compatible with syslog and syslog-ng, which may be configured on a "client" to send log entries (as they occur) via udp (fire and forget) to a remote server (my twisted server).
Is there already something out there that would do this or that would be a good start?
Because of the simplicity of the syslog protocol, you can just use UDPServer with a protocol derived from DatagramProtocol. You just need to overload datagramReceived to do something sensible with the log line received. In short: class SyslogInput(protocol.DatagramProtocol): def datagramReceived(self, data): print "I have received %r" % data service = internet.UDPServer(514, SyslogInput()) -- I WILL NOT BRING SHEEP TO CLASS I WILL NOT BRING SHEEP TO CLASS I WILL NOT BRING SHEEP TO CLASS -+- Bart Simpson on chalkboard in episode 9F06
I'm interested with this. any more progress? thanks HG On Mon, Sep 29, 2008 at 2:18 AM, Marc Byrd <dr.marc.byrd@gmail.com> wrote:
Hi,
I would like to build a syslog(udp port 514) listener in twisted. The goal is to make it compatible with syslog and syslog-ng, which may be configured on a "client" to send log entries (as they occur) via udp (fire and forget) to a remote server (my twisted server).
Is there already something out there that would do this or that would be a good start?
Thanks,
Marc
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Sorry for the late response. This has (obviously) been a background, "wouldn't it be cool" type project. Once I got remote logging over udp working w/ two machines w/ syslog-ng, the tiwsted python part was easy: from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor class Echo(DatagramProtocol): def datagramReceived(self, data, (host, port)): print "received %r from %s:%d" % (data, host, port) self.transport.write(data, (host, port)) reactor.listenUDP(514, Echo()) reactor.run() Part of my problem was that I was trying to use syslog on log-client and syslog-ng on log-server; not sure I (yet) know of any reason why this wouldn't work, but the point is, I got it working well enough to know that the twisted stuff is working as expected. So with syslog-ng on log-clients, all sending to a central log server over udp, listening w/ twisted - the possibilities are endless! Cheers, Marc On Sun, Oct 5, 2008 at 5:12 AM, HG <hackgou@gmail.com> wrote:
I'm interested with this. any more progress? thanks HG
On Mon, Sep 29, 2008 at 2:18 AM, Marc Byrd <dr.marc.byrd@gmail.com> wrote:
Hi,
I would like to build a syslog(udp port 514) listener in twisted. The goal is to make it compatible with syslog and syslog-ng, which may be configured on a "client" to send log entries (as they occur) via udp (fire and forget) to a remote server (my twisted server).
Is there already something out there that would do this or that would be a good start?
Thanks,
Marc
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (4)
-
HG
-
Marc Byrd
-
Nicolas Toper
-
Vincent Bernat