Module logstash.logback.encoder
Class RegexFilteringMdcEntryWriter
java.lang.Object
net.logstash.logback.composite.loggingevent.mdc.RegexFilteringMdcEntryWriter
- All Implemented Interfaces:
MdcEntryWriter
Writes MDC entries by delegating to other instances of
MdcEntryWriter if MDC key matches the given include
and exclude pattern.
- An MDC entry is written if the MDC key does match the
includeMdcKeyPatternAND does not match theexcludeMdcKeyPattern. - Omitting a
includeMdcKeyPatternmeans to include all MDC keys. - Omitting a
excludeMdcKeyPatternmeans to exclude no MDC keys.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMdcEntryWriter(MdcEntryWriter mdcEntryWriter) voidsetExcludeMdcKeyPattern(String excludeMdcKeyPattern) voidsetIncludeMdcKeyPattern(String includeMdcKeyPattern) booleanwriteMdcEntry(JsonGenerator generator, String fieldName, String mdcKey, String mdcValue) Writes the given MDC entry allowing to manipulate the output of the field name and field value.
-
Constructor Details
-
RegexFilteringMdcEntryWriter
public RegexFilteringMdcEntryWriter()
-
-
Method Details
-
writeMdcEntry
public boolean writeMdcEntry(JsonGenerator generator, String fieldName, String mdcKey, String mdcValue) throws IOException Description copied from interface:MdcEntryWriterWrites the given MDC entry allowing to manipulate the output of the field name and field value.- Specified by:
writeMdcEntryin interfaceMdcEntryWriter- Parameters:
generator- the generator to write the entry to.fieldName- the field name to use when writing the entry.mdcKey- the key of the MDC map entry.mdcValue- the value of the MDC map entry.- Returns:
- true if this
MdcEntryWriterhandled the output of the entry, otherwise return false. - Throws:
IOException
-
getIncludeMdcKeyPattern
-
setIncludeMdcKeyPattern
-
getExcludeMdcKeyPattern
-
setExcludeMdcKeyPattern
-
getMdcEntryWriters
-
addMdcEntryWriter
-