Class FilterPattern

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.logs.FilterPattern
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:09.589Z") @Stability(Stable) public class FilterPattern extends software.amazon.jsii.JsiiObject
A collection of static methods to generate appropriate ILogPatterns.

Example:

 // Search for all events where the component field is equal to
 // "HttpServer" and either error is true or the latency is higher
 // than 1000.
 JsonPattern pattern = FilterPattern.all(FilterPattern.stringValue("$.component", "=", "HttpServer"), FilterPattern.any(FilterPattern.booleanValue("$.error", true), FilterPattern.numberValue("$.latency", ">", 1000)));
 
  • 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

      @Stability(Stable) @NotNull public static IFilterPattern 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

      @Stability(Stable) @NotNull public static IFilterPattern anyTerm(@NotNull @NotNull String... terms)
      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

      @Stability(Stable) @NotNull public static JsonPattern exists(@NotNull String jsonField)
      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

      @Stability(Stable) @NotNull public static JsonPattern isNull(@NotNull String jsonField)
      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

      @Stability(Stable) @NotNull public static IFilterPattern literal(@NotNull String logPatternString)
      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

      @Stability(Stable) @NotNull public static JsonPattern notExists(@NotNull String jsonField)
      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.
    • 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.