Crate syslog5424[][src]

A trait based formatter for syslog RFC5424.

This crate includes a struct Rfc5424 that holds metadata associated with the running program that is needed to format messages. Rfc5424 has a function format that formats any type that implements the Rfc5424Data trait.

An example implementation of Rfc5424Data is in the tests module.

There is also a slog implementation here: https://github.com/nocduro/slog-syslog5424

Important details

Some IANA reserved keywords are not implemented yet (timeQuality, and meta).

The formatter is fairly strict in following the RFC. It may truncate fields or remove disallowed characters transparently to the caller. It will also escape characters, as defined in the RFC

The formatter (Rfc5424) has a field for specifying if the message should be written as just the bare RFC5424 format, or if it should be prepended with the length according to RFC5425. If sending to a remote syslog server (such as InfluxDB, or a remote RSYSLOG) this should be enabled, and the connection should be over TLS. However, if sending to the local RSYSLOG the normal 5424 format is likely correct(?).

Modules

iana

Implementations of reserved IANA SD-ID's

types

Types used to specify values in a RFC5424 message

Structs

Rfc5424

Holds the metadata needed for formatting a RFC5424 syslog message.

Rfc5424Builder

Builder for Rfc5424

Enums

Error

Errors returned when verifying validity of metadata

WriteFormat

Format of messages written out. RFC5425 just prepends the length of the 5424 message

Constants

NILVALUE

Value used when a field is optional, and not present

Traits

Rfc5424Data

Trait that defines what data is needed in order to create a RFC5424 message. Any type that implements this can be formatted with a Rfc5424 struct.

Type Definitions

StructuredData

Alias for format of structured data. The RFC does not forbid having duplicate keys for PARAM-NAME, hence the vec of string pairs. I'm not sure if every RFC5424 implementation supports this, so be careful when sending duplicates; the receiver might discard some of them.