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.ResultNested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static ThreadLocal<StringBuilder> Fields inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
onMatch, onMismatchFields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGERFields inherited from interface org.apache.logging.log4j.core.Filter
ELEMENT_TYPE, EMPTY_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateStructuredDataFilter(Map<String, List<String>> map, boolean oper, Filter.Result onMatch, Filter.Result onMismatch) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringBuilderappendOrNull(String value, StringBuilder sb) static StructuredDataFiltercreateFilter(KeyValuePair[] pairs, String oper, Filter.Result match, Filter.Result mismatch) Creates the StructuredDataFilter.Context Filter method.Appender Filter method.protected Filter.Resultfilter(StructuredDataMessage message) private StringBuilderprivate StringBuildergetValue(StructuredDataMessage data, String key) private booleanlistContainsValue(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, toStringMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
equalsImpl, filter, filter, getOnMatch, getOnMismatch, hashCodeImplMethods 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:AbstractFilterAppender Filter method. The default returns NEUTRAL. -
filter
Description copied from class:AbstractFilterContext 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.
-