Module: SemanticLogger::Formatters::SyslogHeader

Included in:
Syslog, SyslogCee
Defined in:
lib/semantic_logger/formatters/syslog_header.rb

Overview

The host name and the application name (the TAG) that the formatters building a remote syslog packet (Syslog and SyslogCee) write in its header.

The syslog_protocol gem, following RFC 3164, allows only printable ASCII characters other than the space (33 to 126) in either, and up to 32 in the TAG, and raises for any other, which made the formatter lose every entry, such as for an application named "Café", or with a name over 32 characters. So the other characters are left out, as the spaces always were from the TAG, and the TAG is cut to 32 characters. When no character is left, "localhost" or "SemanticLogger" is written instead.

Each is worked out once, and again only when the host or application name changes.

Constant Summary collapse

MAX_TAG_SIZE =

The most characters that the TAG of a syslog header can hold.

32
DEFAULT_HOSTNAME =

Written in place of a host name with no character left.

"localhost".encode(Encoding::US_ASCII).freeze
DEFAULT_TAG =

Written in place of an application name with no character left.

"SemanticLogger".encode(Encoding::US_ASCII).freeze