loggerglue.emitter — Emit syslog messages over the network or a local socket

An rfc5424/rfc5425 syslog server implementation Copyright © 2011 Evax Software <contact@evax.fr>

class loggerglue.emitter.SyslogEmitter

Bases: object

Base class for syslog emitters.

A syslog emitter provides two methods, one to send messages and one to close the connection. All emitters are set up such that the connection is re-established once when a network issue happens. If the re-connection attempt fails, a socket exception is thrown.

Derived classes have specific constructors describing the address to send messages to.

close()

Closes the socket.

emit(msg)

Emit a log record.

class loggerglue.emitter.TCPSyslogEmitter(address=('localhost', 514), octet_based_framing=True, **ssl_args)

Bases: loggerglue.emitter.SyslogEmitter

Syslog emitter that sends messages through a TCP socket. Optionally supports TLS.

Arguments
address
Address to send messages to, specify this as (host, port) tuple.
octet_based_framing
Use RFC5425 octet-based framing instead of line-based framing. Use this when sending multiline messages.
keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, ciphers
Arguments to pass through to ssl.wrap_socket(). Providing any of these arguments enables TLS.
close()

Closes the socket.

emit(msg)

Emit a record.

class loggerglue.emitter.UDPSyslogEmitter(address=('localhost', 514))

Bases: loggerglue.emitter.SyslogEmitter

Syslog emitter through UDP.

Sends syslog messages over UDP. As UDP is an unreliable protocol, use of this class is discouraged. The only use-case would be sending messages to a syslog server that does not support TCP.

Create a Syslog emitter that sends messages through UDP.

Arguments

address
address to send messages to, as (host,port) tuple
close()

Closes the socket.

emit(msg)

Emit a record.

Previous topic

loggerglue.constants — Syslog constants

Next topic

loggerglue.logger — Convenience class for logging RFC5424-formatted messages

This Page