FilterPattern
- class aws_cdk.aws_logs.FilterPattern
- Bases: - object- A collection of static methods to generate appropriate ILogPatterns. - ExampleMetadata:
- infused 
 - Example: - import aws_cdk.aws_logs_destinations as destinations # fn: lambda.Function # log_group: logs.LogGroup logs.SubscriptionFilter(self, "Subscription", log_group=log_group, destination=destinations.LambdaDestination(fn), filter_pattern=logs.FilterPattern.all_terms("ERROR", "MainThread"), filter_name="ErrorInMainThread" ) - Static Methods - classmethod all(*patterns)
- A JSON log pattern that matches if all given JSON log patterns match. - Parameters:
- patterns ( - JsonPattern)
- Return type:
 
 - classmethod all_events()
- A log pattern that matches all events. - Return type:
 
 - classmethod all_terms(*terms)
- A log pattern that matches if all the strings given appear in the event. - Parameters:
- terms ( - str) – The words to search for. All terms must match.
- Return type:
 
 - classmethod any(*patterns)
- A JSON log pattern that matches if any of the given JSON log patterns match. - Parameters:
- patterns ( - JsonPattern)
- Return type:
 
 - classmethod any_term(*terms)
- A log pattern that matches if any of the strings given appear in the event. - Parameters:
- terms ( - str) – The words to search for. Any terms must match.
- Return type:
 
 - classmethod any_term_group(*term_groups)
- 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:
- term_groups ( - List[- str]) – A list of term groups to search for. Any one of the clauses must match.
- Return type:
 
 - classmethod boolean_value(json_field, value)
- A JSON log pattern that matches if the field exists and equals the boolean value. - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- value ( - bool) – The value to match.
 
- Return type:
 
 - classmethod exists(json_field)
- A JSON log patter that matches if the field exists. - This is a readable convenience wrapper over ‘field = *’ - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- Return type:
 
 - classmethod is_null(json_field)
- A JSON log pattern that matches if the field exists and has the special value ‘null’. - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- Return type:
 
 - classmethod literal(log_pattern_string)
- 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:
- log_pattern_string ( - str) – The pattern string to use.
- Return type:
 
 - classmethod not_exists(json_field)
- A JSON log pattern that matches if the field does not exist. - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- Return type:
 
 - classmethod number_value(json_field, comparison, 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: - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- comparison ( - str) – Comparison to carry out. One of =, !=, <, <=, >, >=.
- value ( - Union[- int,- float]) – The numerical value to compare to.
 
- Return type:
 
 - classmethod regex_value(json_field, comparison, 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: - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- comparison ( - str) – Comparison to carry out. Either = or !=.
- value ( - str) – The regex value to compare to.
 
- Return type:
 
 - classmethod space_delimited(*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 ( - str) – The columns in the space-delimited log stream.
- Return type:
 
 - classmethod string_value(json_field, comparison, 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: - Parameters:
- json_field ( - str) – Field inside JSON. Example: “$.myField”
- comparison ( - str) – Comparison to carry out. Either = or !=.
- value ( - str) – The string value to compare to. May use ‘*’ as wildcard at start or end of string.
 
- Return type: