Class Rfc5424Layout

All Implemented Interfaces:
LocationAware, Layout<String>, Encoder<LogEvent>, StringLayout

@Plugin(name="Rfc5424Layout", category="Core", elementType="layout", printObject=true) public final class Rfc5424Layout extends AbstractStringLayout
Formats a log event in accordance with RFC 5424.
See Also:
  • Field Details


      public static final int DEFAULT_ENTERPRISE_NUMBER
      The default example enterprise number from RFC5424.
      See Also:

      public static final String DEFAULT_ID
      The default event id.
      See Also:

      public static final Pattern NEWLINE_PATTERN
      Match newlines in a platform-independent manner.

      @Deprecated public static final Pattern PARAM_VALUE_ESCAPE_PATTERN
      Match characters which require escaping.

      public static final Pattern ENTERPRISE_ID_PATTERN
      For now, avoid too restrictive OID checks to allow for easier transition

      public static final String DEFAULT_MDCID
      Default MDC ID: "mdc" .
      See Also:
  • Method Details

    • getContentFormat

      public Map<String,String> getContentFormat()
      Gets this Rfc5424Layout's content format. Specified by:
      • Key: "structured" Value: "true"
      • Key: "format" Value: "RFC5424"
      Specified by:
      getContentFormat in interface Layout<String>
      getContentFormat in class AbstractLayout<String>
      Map of content format keys supporting Rfc5424Layout
    • toSerializable

      public String toSerializable(LogEvent event)
      Formats a LogEvent in conformance with the RFC 5424 Syslog specification.
      event - The LogEvent.
      The RFC 5424 String representation of the LogEvent.
    • getProcId

      protected String getProcId()
    • getMdcExcludes

      protected List<String> getMdcExcludes()
    • getMdcIncludes

      protected List<String> getMdcIncludes()
    • toString

      public String toString()
      toString in class Object
    • createLayout

      @PluginFactory public static Rfc5424Layout createLayout(@PluginAttribute(value="facility",defaultString="LOCAL0") Facility facility, @PluginAttribute("id") String id, @PluginAttribute(value="enterpriseNumber",defaultInt=32473) int enterpriseNumber, @PluginAttribute(value="includeMDC",defaultBoolean=true) boolean includeMDC, @PluginAttribute(value="mdcId",defaultString="mdc") String mdcId, @PluginAttribute("mdcPrefix") String mdcPrefix, @PluginAttribute("eventPrefix") String eventPrefix, @PluginAttribute("newLine") boolean newLine, @PluginAttribute("newLineEscape") String escapeNL, @PluginAttribute("appName") String appName, @PluginAttribute("messageId") String msgId, @PluginAttribute("mdcExcludes") String excludes, @PluginAttribute("mdcIncludes") String includes, @PluginAttribute("mdcRequired") String required, @PluginAttribute("exceptionPattern") String exceptionPattern, @PluginAttribute("useTlsMessageFormat") boolean useTlsMessageFormat, @PluginElement("LoggerFields") LoggerFields[] loggerFields, @PluginConfiguration Configuration config)
      Create the RFC 5424 Layout.
      facility - The Facility is used to try to classify the message.
      id - The default structured data id to use when formatting according to RFC 5424.
      enterpriseNumber - The IANA enterprise number.
      includeMDC - Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog record. Defaults to "true:.
      mdcId - The id to use for the MDC Structured Data Element.
      mdcPrefix - The prefix to add to MDC key names.
      eventPrefix - The prefix to add to event key names.
      newLine - If true, a newline will be appended to the end of the syslog record. The default is false.
      escapeNL - String that should be used to replace newlines within the message text.
      appName - The value to use as the APP-NAME in the RFC 5424 syslog record.
      msgId - The default value to be used in the MSGID field of RFC 5424 syslog records.
      excludes - A comma separated list of MDC keys that should be excluded from the LogEvent.
      includes - A comma separated list of MDC keys that should be included in the FlumeEvent.
      required - A comma separated list of MDC keys that must be present in the MDC.
      exceptionPattern - The pattern for formatting exceptions.
      useTlsMessageFormat - If true the message will be formatted according to RFC 5425.
      loggerFields - Container for the KeyValuePairs containing the patterns
      config - The Configuration. Some Converters require access to the Interpolator.
      An Rfc5424Layout.
    • getFacility

      public Facility getFacility()
    • getDefaultId

      public String getDefaultId()
    • getEnterpriseNumber

      public String getEnterpriseNumber()
    • isIncludeMdc

      public boolean isIncludeMdc()
    • getMdcId

      public String getMdcId()