loggerglue.rfc5424 — Parser and log record wrapper classes

A parser for the Syslog Protocol (RFC5424 - http://tools.ietf.org/search/rfc542)

Copyright © 2011 Evax Software <contact@evax.fr>

class loggerglue.rfc5424.SDElement(sd_id, sd_params)

Bases: object

An SD-ELEMENT consists of a name and parameter name-value pairs.

arguments
sd_id
SD-IDs are case-sensitive and uniquely identify the type and purpose of the SD-ELEMENT.
sd_params
Key/value pairs attached to this SD-ELEMENT. This can be any iterable that yields tuples, a dict or a OrderedMultiDict (An SD-PARAM key may be repeated multiple times inside an SD-ELEMENT)
attributes
id
SD-ID for this structured data element.
sd_params
Key/value pairs attached to this SD-ELEMENT, represented as a multidict.
params
Key/value pairs attached to this SD-ELEMENT, represented as a class instance (for convenience, so that parameters can be addressed with elmt.params.origin). If there are multiple values for a key, the last element is returned.
class loggerglue.rfc5424.SyslogEntry(prival=14, version=1, timestamp=None, hostname=None, app_name=None, procid=None, msgid=None, structured_data=None, msg=None)

Bases: object

A class representing a syslog entry.

arguments/attributes

prival
RFC5424 priority values are a combination of a priority and facility, for example LOG_ALERT | LOG_DAEMON. See loggerglue.constants.
version
Version of syslog entry. There is usually no need to change this.
timestamp
Timestamp (as a datetime object).
hostname
The HOSTNAME field SHOULD contain the hostname and the domain name of the originator.
app_name
The APP-NAME field SHOULD identify the device or application that originated the message. It is a string without further semantics. It is intended for filtering messages on a relay or collector.
procid
PROCID is a value that is included in the message, having no interoperable meaning, except that a change in the value indicates there has been a discontinuity in syslog reporting.
msgid
The MSGID SHOULD identify the type of message.
structured_data
STRUCTURED-DATA provides a mechanism to express information in a well defined, easily parseable and interpretable data format.
msg
The MSG part contains a free-form message that provides information about the event.
classmethod from_line(line)

Returns a parsed SyslogEntry object from a syslog line.

Previous topic

API reference

Next topic

loggerglue.constants — Syslog constants

This Page