Class Rfc5424Layout
java.lang.Object
org.apache.logging.log4j.core.layout.AbstractLayout<String>
org.apache.logging.log4j.core.layout.AbstractStringLayout
org.apache.logging.log4j.core.layout.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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
AbstractStringLayout.Builder<B extends AbstractStringLayout.Builder<B>>, AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default example enterprise number from RFC5424.static final String
The default event id.static final String
Default MDC ID: "mdc" .static final Pattern
For now, avoid too restrictive OID checks to allow for easier transitionstatic final Pattern
Match newlines in a platform-independent manner.static final Pattern
Deprecated.Fields inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZE
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
configuration, eventCount, footer, header, LOGGER
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
-
Method Summary
Modifier and TypeMethodDescriptionstatic Rfc5424Layout
createLayout
(Facility facility, String id, int enterpriseNumber, boolean includeMDC, String mdcId, String mdcPrefix, String eventPrefix, boolean newLine, String escapeNL, String appName, String msgId, String excludes, String includes, String required, String exceptionPattern, boolean useTlsMessageFormat, LoggerFields[] loggerFields, Configuration config) Deprecated.Gets this Rfc5424Layout's content format.getMdcId()
protected String
boolean
toSerializable
(LogEvent event) Formats aLogEvent
in conformance with the RFC 5424 Syslog specification.toString()
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSize
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
encode, getConfiguration, markEvent
-
Field Details
-
DEFAULT_ENTERPRISE_NUMBER
public static final int DEFAULT_ENTERPRISE_NUMBERThe default example enterprise number from RFC5424.- See Also:
-
DEFAULT_ID
The default event id.- See Also:
-
NEWLINE_PATTERN
Match newlines in a platform-independent manner. -
PARAM_VALUE_ESCAPE_PATTERN
Deprecated.Match characters which require escaping. -
ENTERPRISE_ID_PATTERN
For now, avoid too restrictive OID checks to allow for easier transition -
DEFAULT_MDCID
Default MDC ID: "mdc" .- See Also:
-
-
Method Details
-
getContentFormat
Gets this Rfc5424Layout's content format. Specified by:- Key: "structured" Value: "true"
- Key: "format" Value: "RFC5424"
- Specified by:
getContentFormat
in interfaceLayout<String>
- Overrides:
getContentFormat
in classAbstractLayout<String>
- Returns:
- Map of content format keys supporting Rfc5424Layout
-
toSerializable
Formats aLogEvent
in conformance with the RFC 5424 Syslog specification.- Parameters:
event
- The LogEvent.- Returns:
- The RFC 5424 String representation of the LogEvent.
-
getProcId
-
getMdcExcludes
-
getMdcIncludes
-
toString
-
createLayout
@Deprecated public static Rfc5424Layout createLayout(Facility facility, String id, int enterpriseNumber, boolean includeMDC, String mdcId, String mdcPrefix, String eventPrefix, boolean newLine, String escapeNL, String appName, String msgId, String excludes, String includes, String required, String exceptionPattern, boolean useTlsMessageFormat, LoggerFields[] loggerFields, Configuration config) Deprecated.Useinstead
Create the RFC 5424 Layout.- Parameters:
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 patternsconfig
- The Configuration. Some Converters require access to the Interpolator.- Returns:
- An Rfc5424Layout.
-
newBuilder
-
getFacility
-
getDefaultId
-
getEnterpriseNumber
-
isIncludeMdc
public boolean isIncludeMdc() -
getMdcId
-
instead