Struct slog_syslog5424::Rfc5424Builder[][src]

pub struct Rfc5424Builder { /* fields omitted */ }

Builder for Rfc5424

Methods

impl Rfc5424Builder
[src]

Transform the builder into a formatter struct.

Set the hostname used in the header of the syslog message.

Errors

  • val's length is larger than 255
  • val is an empty string
  • val doesn't contain printable ASCII characters (see char::is_ascii_graphic)

Set the app name used in the header of the syslog message.

Errors

  • val's length is larger than 48
  • val is an empty string
  • val doesn't contain printable ASCII characters (see char::is_ascii_graphic)

Set the process id (PID) used in the header of the syslog message.

Errors

  • val's length is larger than 128
  • val is an empty string
  • val doesn't contain printable ASCII characters (see char::is_ascii_graphic)

Set the msgId used in the header of the syslog message. (OPTIONAL)

The MSGID SHOULD identify the type of message. For example, a firewall might use the MSGID "TCPIN" for incoming TCP traffic and the MSGID "TCPOUT" for outgoing TCP traffic. Messages with the same MSGID should reflect events of the same semantics. The MSGID itself is a string without further semantics. It is intended for filtering messages on a relay or collector.

Errors

  • val's length is larger than 32
  • val is an empty string
  • val doesn't contain printable ASCII characters (see char::is_ascii_graphic)

Set the format of the output between RFC5424 and RFC5425.

RFC5425 is the same as RFC5424 except it prepends the length of the message.

Example

RFC5424: <11>1 - server1.example.com my_app_name 5445 msg_id [hello@ent_id id="54" progress="complete"] sample message

RFC5425: 130 <11>1 - server1.example.com my_app_name 5445 msg_id [hello@ent_id id="54" progress="complete"] sample message

Add an IANA reserved origin key-value pair.

Examples

This example is not tested
let f = Rfc5424Builder::new("enterprise_id", Facility::User)
    .origin(Origin::Ip("127.0.0.1"))
    .origin(Origin::Version("12.2.1"))
    .build();

Add an IANA reserved time quality key-value pair.

Examples

This example is not tested
let f = Rfc5424Builder::new("enterprise_id", Facility::User)
    .time_quality(TimeQuality::TzKnown(true))
    .time_quality(TimeQuality::IsSynced(true))
    .time_quality(TimeQuality::SyncAccuracy(1000))
    .build();

Auto Trait Implementations