Class StructuredDataFilter
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilter
org.apache.logging.log4j.core.filter.MapFilter
org.apache.logging.log4j.core.filter.StructuredDataFilter
- All Implemented Interfaces:
Filter
,LifeCycle
,LifeCycle2
@Plugin(name="StructuredDataFilter",
category="Core",
elementType="filter",
printObject=true)
public final class StructuredDataFilter
extends MapFilter
Filter based on data in a StructuredDataMessage.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
AbstractFilter.AbstractFilterBuilder<B extends AbstractFilter.AbstractFilterBuilder<B>>
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.Filter
Filter.Result
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static ThreadLocal
<StringBuilder> Fields inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
onMatch, onMismatch
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
Fields inherited from interface org.apache.logging.log4j.core.Filter
ELEMENT_TYPE, EMPTY_ARRAY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
StructuredDataFilter
(Map<String, List<String>> map, boolean oper, Filter.Result onMatch, Filter.Result onMismatch) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringBuilder
appendOrNull
(String value, StringBuilder sb) static StructuredDataFilter
createFilter
(KeyValuePair[] pairs, String oper, Filter.Result match, Filter.Result mismatch) Creates the StructuredDataFilter.Context Filter method.Appender Filter method.protected Filter.Result
filter
(StructuredDataMessage message) private StringBuilder
private StringBuilder
getValue
(StructuredDataMessage data, String key) private boolean
listContainsValue
(List<String> candidates, StringBuilder toMatch) Methods inherited from class org.apache.logging.log4j.core.filter.MapFilter
filter, filter, filter, filter, filter, filter, filter, filter, filter, filter, filter, filter, filter, getMap, getStringMap, isAnd, toString
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
equalsImpl, filter, filter, getOnMatch, getOnMismatch, hashCodeImpl
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
getState, getStatusLogger, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop, stop
-
Field Details
-
MAX_BUFFER_SIZE
private static final int MAX_BUFFER_SIZE- See Also:
-
threadLocalStringBuilder
-
-
Constructor Details
-
StructuredDataFilter
private StructuredDataFilter(Map<String, List<String>> map, boolean oper, Filter.Result onMatch, Filter.Result onMismatch)
-
-
Method Details
-
filter
Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL. -
filter
Description copied from class:AbstractFilter
Context Filter method. The default returns NEUTRAL. -
filter
-
getValue
-
getStringBuilder
-
appendOrNull
-
listContainsValue
-
createFilter
@PluginFactory public static StructuredDataFilter createFilter(@PluginElement("Pairs") KeyValuePair[] pairs, @PluginAttribute("operator") String oper, @PluginAttribute("onMatch") Filter.Result match, @PluginAttribute("onMismatch") Filter.Result mismatch) Creates the StructuredDataFilter.- Parameters:
pairs
- Key and value pairs.oper
- The operator to perform. If not "or" the operation will be an "and".match
- The action to perform on a match.mismatch
- The action to perform on a mismatch.- Returns:
- The StructuredDataFilter.
-