Class FilterPattern
A collection of static methods to generate appropriate ILogPatterns.
Inheritance
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FilterPattern : DeputyBase
Syntax (vb)
Public Class FilterPattern
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// Search for all events where the component field is equal to
// "HttpServer" and either error is true or the latency is higher
// than 1000.
var pattern = FilterPattern.All(FilterPattern.StringValue("$.component", "=", "HttpServer"), FilterPattern.Any(FilterPattern.BooleanValue("$.error", true), FilterPattern.NumberValue("$.latency", ">", 1000)));
Synopsis
Constructors
FilterPattern() | |
FilterPattern(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
FilterPattern(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
All(JsonPattern[]) | A JSON log pattern that matches if all given JSON log patterns match. |
AllEvents() | A log pattern that matches all events. |
AllTerms(String[]) | A log pattern that matches if all the strings given appear in the event. |
Any(JsonPattern[]) | A JSON log pattern that matches if any of the given JSON log patterns match. |
AnyTerm(String[]) | A log pattern that matches if any of the strings given appear in the event. |
AnyTermGroup(String[][]) | A log pattern that matches if any of the given term groups matches the event. |
BooleanValue(String, Boolean) | A JSON log pattern that matches if the field exists and equals the boolean value. |
Exists(String) | A JSON log patter that matches if the field exists. |
IsNull(String) | A JSON log pattern that matches if the field exists and has the special value 'null'. |
Literal(String) | Use the given string as log pattern. |
NotExists(String) | A JSON log pattern that matches if the field does not exist. |
NumberValue(String, String, Double) | A JSON log pattern that compares numerical values. |
SpaceDelimited(String[]) | A space delimited log pattern matcher. |
StringValue(String, String, String) | A JSON log pattern that compares string values. |
Constructors
FilterPattern()
public FilterPattern()
FilterPattern(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected FilterPattern(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
FilterPattern(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected FilterPattern(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
All(JsonPattern[])
A JSON log pattern that matches if all given JSON log patterns match.
public static JsonPattern All(params JsonPattern[] patterns)
Parameters
- patterns JsonPattern[]
Returns
AllEvents()
A log pattern that matches all events.
public static IFilterPattern AllEvents()
Returns
AllTerms(String[])
A log pattern that matches if all the strings given appear in the event.
public static IFilterPattern AllTerms(params string[] terms)
Parameters
- terms System.String[]
The words to search for.
Returns
Any(JsonPattern[])
A JSON log pattern that matches if any of the given JSON log patterns match.
public static JsonPattern Any(params JsonPattern[] patterns)
Parameters
- patterns JsonPattern[]
Returns
AnyTerm(String[])
A log pattern that matches if any of the strings given appear in the event.
public static IFilterPattern AnyTerm(params string[] terms)
Parameters
- terms System.String[]
The words to search for.
Returns
AnyTermGroup(String[][])
A log pattern that matches if any of the given term groups matches the event.
public static IFilterPattern AnyTermGroup(params string[][] termGroups)
Parameters
- termGroups System.String[][]
A list of term groups to search for.
Returns
Remarks
A term group matches an event if all the terms in it appear in the event string.
BooleanValue(String, Boolean)
A JSON log pattern that matches if the field exists and equals the boolean value.
public static JsonPattern BooleanValue(string jsonField, bool value)
Parameters
- jsonField System.String
Field inside JSON.
- value System.Boolean
The value to match.
Returns
Exists(String)
A JSON log patter that matches if the field exists.
public static JsonPattern Exists(string jsonField)
Parameters
- jsonField System.String
Field inside JSON.
Returns
Remarks
This is a readable convenience wrapper over 'field = *'
IsNull(String)
A JSON log pattern that matches if the field exists and has the special value 'null'.
public static JsonPattern IsNull(string jsonField)
Parameters
- jsonField System.String
Field inside JSON.
Returns
Literal(String)
Use the given string as log pattern.
public static IFilterPattern Literal(string logPatternString)
Parameters
- logPatternString System.String
The pattern string to use.
Returns
Remarks
See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html for information on writing log patterns.
NotExists(String)
A JSON log pattern that matches if the field does not exist.
public static JsonPattern NotExists(string jsonField)
Parameters
- jsonField System.String
Field inside JSON.
Returns
NumberValue(String, String, Double)
A JSON log pattern that compares numerical values.
public static JsonPattern NumberValue(string jsonField, string comparison, double value)
Parameters
- jsonField System.String
Field inside JSON.
- comparison System.String
Comparison to carry out.
- value System.Double
The numerical value to compare to.
Returns
Remarks
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
SpaceDelimited(String[])
A space delimited log pattern matcher.
public static SpaceDelimitedTextPattern SpaceDelimited(params string[] columns)
Parameters
- columns System.String[]
The columns in the space-delimited log stream.
Returns
Remarks
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.
StringValue(String, String, String)
A JSON log pattern that compares string values.
public static JsonPattern StringValue(string jsonField, string comparison, string value)
Parameters
- jsonField System.String
Field inside JSON.
- comparison System.String
Comparison to carry out.
- value System.String
The string value to compare to.
Returns
Remarks
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