Skip to content
v2.278.0

GrokProperty Struct ​

This processor uses pattern matching to parse and structure unstructured data.

This processor can also extract fields from log messages. For more information about this processor including examples, see grok in the CloudWatch Logs User Guide.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_logs as logs } from 'aws-cdk-lib';
const grokProperty: logs.GrokProperty = {
  match: 'match',

  // the properties below are optional
  source: 'source',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_logs as logs

grok_property = logs.GrokProperty(
    match="match",

    # the properties below are optional
    source="source"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.logs.*;

GrokProperty grokProperty = GrokProperty.builder()
        .match("match")

        // the properties below are optional
        .source("source")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Logs;

var grokProperty = new GrokProperty {
    Match = "match",

    // the properties below are optional
    Source = "source"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

grokProperty := &GrokProperty{
	Match: jsii.String("match"),

	// the properties below are optional
	Source: jsii.String("source"),
}

Properties ​

matchstringmatchstrmatchStringMatchstringMatch*string required #
The grok pattern to match against the log event.

For a list of supported grok patterns, see Supported grok patterns in the CloudWatch Logs User Guide.

sourceoptionalstringsourceoptionalstrsourceoptionalStringSourceoptionalstringSourceoptional*string = '@message' #
The path to the field in the log event that you want to parse.