Package Products :: Package ZenEvents :: Module zensyslog :: Class SyslogTask
[hide private]
[frames] | no frames]

Class SyslogTask

source code

                           ZenCollector.tasks.BaseTask --+
                                                         |
twisted.internet.protocol.AbstractDatagramProtocol --+   |
                                                     |   |
            twisted.internet.protocol.DatagramProtocol --+
                                                         |
                                                        SyslogTask

Listen for syslog messages and turn them into events Connects to the TrapService service in zenhub.

Instance Methods [hide private]
 
__init__(self, taskName, configId, scheduleIntervalSeconds=3600, taskConfig=None) source code
 
doTask(self)
This is a wait-around task since we really are called asynchronously.
source code
 
useUdpFileDescriptor(self, fd) source code
string
expand(self, msg, client_address)
Expands a syslog message into a string format suitable for writing to the filesystem such that it appears the same as it would had the message been logged by the syslog daemon.
source code
 
datagramReceived(self, msg, client_address)
Consume the network packet
source code
 
gotHostname(self, response, data)
Send the resolved address, if possible, and the event via the thread
source code
 
displayStatistics(self) source code
 
cleanup(self) source code

Inherited from twisted.internet.protocol.DatagramProtocol: connectionRefused

Inherited from twisted.internet.protocol.AbstractDatagramProtocol: __getstate__, doStart, doStop, makeConnection, startProtocol, stopProtocol

Class Variables [hide private]
  SYSLOG_DATE_FORMAT = '%b %d %H:%M:%S'
  SAMPLE_DATE = 'Apr 10 15:19:22'

Inherited from twisted.internet.protocol.AbstractDatagramProtocol: noisy, numPorts

Instance Variables [hide private]

Inherited from twisted.internet.protocol.DatagramProtocol: transport

Method Details [hide private]

expand(self, msg, client_address)

source code 

Expands a syslog message into a string format suitable for writing to the filesystem such that it appears the same as it would had the message been logged by the syslog daemon.

Parameters:
  • msg (string) - syslog message
  • client_address (tuple of (string, number)) - IP info of the remote device (ipaddr, port)
Returns: string
message

datagramReceived(self, msg, client_address)

source code 

Consume the network packet

Parameters:
  • msg (string) - syslog message
  • client_address (tuple of (string, number)) - IP info of the remote device (ipaddr, port)
Overrides: twisted.internet.protocol.AbstractDatagramProtocol.datagramReceived

gotHostname(self, response, data)

source code 

Send the resolved address, if possible, and the event via the thread

Parameters:
  • response (Twisted response) - Twisted response
  • data (tuple of (string, string, datetime object)) - (msg, ipaddr, rtime)