[Twisted-Python] Syslog Listener UDP

Marc Byrd dr.marc.byrd at gmail.com
Tue Dec 16 14:55:06 EST 2008


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 at 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 at 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 at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20081216/d9343343/attachment.htm 


More information about the Twisted-Python mailing list