Class FilterPattern
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Example:
import software.amazon.awscdk.services.logs.destinations.*;
Function fn;
LogGroup logGroup;
SubscriptionFilter.Builder.create(this, "Subscription")
.logGroup(logGroup)
.destination(new LambdaDestination(fn))
.filterPattern(FilterPattern.allTerms("ERROR", "MainThread"))
.filterName("ErrorInMainThread")
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFilterPattern(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedFilterPattern(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonPatternall(@NotNull JsonPattern... patterns) A JSON log pattern that matches if all given JSON log patterns match.static IFilterPatternA log pattern that matches all events.static IFilterPatternA log pattern that matches if all the strings given appear in the event.static JsonPatternany(@NotNull JsonPattern... patterns) A JSON log pattern that matches if any of the given JSON log patterns match.static IFilterPatternA log pattern that matches if any of the strings given appear in the event.static IFilterPatternanyTermGroup(@NotNull List<String>... termGroups) A log pattern that matches if any of the given term groups matches the event.static JsonPatternbooleanValue(String jsonField, Boolean value) A JSON log pattern that matches if the field exists and equals the boolean value.static JsonPatternA JSON log patter that matches if the field exists.static JsonPatternA JSON log pattern that matches if the field exists and has the special value 'null'.static IFilterPatternUse the given string as log pattern.static JsonPatternA JSON log pattern that matches if the field does not exist.static JsonPatternnumberValue(String jsonField, String comparison, Number value) A JSON log pattern that compares numerical values.static JsonPatternregexValue(String jsonField, String comparison, String value) A JSON log pattern that compares against a Regex values.static SpaceDelimitedTextPatternspaceDelimited(@NotNull String... columns) A space delimited log pattern matcher.static JsonPatternstringValue(String jsonField, String comparison, String value) A JSON log pattern that compares string values.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
FilterPattern
protected FilterPattern(software.amazon.jsii.JsiiObjectRef objRef) -
FilterPattern
protected FilterPattern(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
FilterPattern
@Stability(Stable) public FilterPattern()
-
-
Method Details
-
all
@Stability(Stable) @NotNull public static JsonPattern all(@NotNull @NotNull JsonPattern... patterns) A JSON log pattern that matches if all given JSON log patterns match.- Parameters:
patterns- This parameter is required.
-
allEvents
A log pattern that matches all events. -
allTerms
@Stability(Stable) @NotNull public static IFilterPattern allTerms(@NotNull @NotNull String... terms) A log pattern that matches if all the strings given appear in the event.- Parameters:
terms- The words to search for. This parameter is required.
-
any
@Stability(Stable) @NotNull public static JsonPattern any(@NotNull @NotNull JsonPattern... patterns) A JSON log pattern that matches if any of the given JSON log patterns match.- Parameters:
patterns- This parameter is required.
-
anyTerm
A log pattern that matches if any of the strings given appear in the event.- Parameters:
terms- The words to search for. This parameter is required.
-
anyTermGroup
@Stability(Stable) @NotNull public static IFilterPattern anyTermGroup(@NotNull @NotNull List<String>... termGroups) A log pattern that matches if any of the given term groups matches the event.A term group matches an event if all the terms in it appear in the event string.
- Parameters:
termGroups- A list of term groups to search for. This parameter is required.
-
booleanValue
@Stability(Stable) @NotNull public static JsonPattern booleanValue(@NotNull String jsonField, @NotNull Boolean value) A JSON log pattern that matches if the field exists and equals the boolean value.- Parameters:
jsonField- Field inside JSON. This parameter is required.value- The value to match. This parameter is required.
-
exists
A JSON log patter that matches if the field exists.This is a readable convenience wrapper over 'field = *'
- Parameters:
jsonField- Field inside JSON. This parameter is required.
-
isNull
A JSON log pattern that matches if the field exists and has the special value 'null'.- Parameters:
jsonField- Field inside JSON. This parameter is required.
-
literal
Use the given string as log pattern.See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html for information on writing log patterns.
- Parameters:
logPatternString- The pattern string to use. This parameter is required.
-
notExists
A JSON log pattern that matches if the field does not exist.- Parameters:
jsonField- Field inside JSON. This parameter is required.
-
numberValue
@Stability(Stable) @NotNull public static JsonPattern numberValue(@NotNull String jsonField, @NotNull String comparison, @NotNull Number value) A JSON log pattern that compares numerical values.This pattern only matches if the event is a JSON event, and the indicated field inside compares with the value in the indicated way.
Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality. The '*' wildcard may appear in the value may at the start or at the end.
For more information, see:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
- Parameters:
jsonField- Field inside JSON. This parameter is required.comparison- Comparison to carry out. This parameter is required.value- The numerical value to compare to. This parameter is required.
-
regexValue
@Stability(Stable) @NotNull public static JsonPattern regexValue(@NotNull String jsonField, @NotNull String comparison, @NotNull String value) A JSON log pattern that compares against a Regex values.This pattern only matches if the event is a JSON event, and the indicated field inside compares with the regex value.
Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality.
For more information, see:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
- Parameters:
jsonField- Field inside JSON. This parameter is required.comparison- Comparison to carry out. This parameter is required.value- The regex value to compare to. This parameter is required.
-
spaceDelimited
@Stability(Stable) @NotNull public static SpaceDelimitedTextPattern spaceDelimited(@NotNull @NotNull String... columns) A space delimited log pattern matcher.The log event is divided into space-delimited columns (optionally enclosed by "" or [] to capture spaces into column values), and names are given to each column.
'...' may be specified once to match any number of columns.
Afterwards, conditions may be added to individual columns.
- Parameters:
columns- The columns in the space-delimited log stream. This parameter is required.
-
stringValue
@Stability(Stable) @NotNull public static JsonPattern stringValue(@NotNull String jsonField, @NotNull String comparison, @NotNull String value) A JSON log pattern that compares string values.This pattern only matches if the event is a JSON event, and the indicated field inside compares with the string value.
Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality. The '*' wildcard may appear in the value may at the start or at the end.
For more information, see:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html
- Parameters:
jsonField- Field inside JSON. This parameter is required.comparison- Comparison to carry out. This parameter is required.value- The string value to compare to. This parameter is required.
-