Class SyslogLayout

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

@Plugin(name="SyslogLayout", category="Core", elementType="layout", printObject=true) public final class SyslogLayout extends AbstractStringLayout
Formats a log event as a BSD Log record.
  • Field Details

    • NEWLINE_PATTERN

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

    • SyslogLayout

      protected SyslogLayout(Facility facility, boolean includeNL, String escapeNL, Charset charset)
  • Method Details

    • newBuilder

      @PluginBuilderFactory public static <B extends SyslogLayout.Builder<B>> B newBuilder()
    • toSerializable

      public String toSerializable(LogEvent event)
      Formats a LogEvent in conformance with the BSD Log record format.
      Parameters:
      event - The LogEvent
      Returns:
      the event formatted as a String.
    • getContentFormat

      public Map<String,String> getContentFormat()
      Gets this SyslogLayout's content format. Specified by:
      • Key: "structured" Value: "false"
      • Key: "dateFormat" Value: "MMM dd HH:mm:ss"
      • Key: "format" Value: "<LEVEL>TIMESTAMP PROP(HOSTNAME) MESSAGE"
      • Key: "formatType" Value: "logfilepatternreceiver" (format uses the keywords supported by LogFilePatternReceiver)
      Specified by:
      getContentFormat in interface Layout<String>
      Overrides:
      getContentFormat in class AbstractLayout<String>
      Returns:
      Map of content format keys supporting SyslogLayout
    • createLayout

      @Deprecated public static SyslogLayout createLayout(Facility facility, boolean includeNewLine, String escapeNL, Charset charset)
      Deprecated.
      Creates a SyslogLayout.
      Parameters:
      facility - The Facility is used to try to classify the message.
      includeNewLine - If true a newline will be appended to the result.
      escapeNL - Pattern to use for replacing newlines.
      charset - The character set.
      Returns:
      A SyslogLayout.
    • getFacility

      public Facility getFacility()
      Gets the facility.
      Returns:
      the facility