This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-logs

AWS CloudWatch Logs Construct Library

This library supplies constructs for working with CloudWatch Logs.

Log Groups/Streams

The basic unit of CloudWatch is a Log Group. Every log group typically has the same kind of data logged to it, in the same format. If there are multiple applications or services logging into the Log Group, each of them creates a new Log Stream.

Every log operation creates a “log event”, which can consist of a simple string or a single-line JSON object. JSON objects have the advantage that they afford more filtering abilities (see below).

The only configurable attribute for log streams is the retention period, which configures after how much time the events in the log stream expire and are deleted.

The default retention period if not supplied is 2 years, but it can be set to any amount of days, or Infinity to keep the data in the log group forever.

// Configure log group for short retention
const logGroup = new LogGroup(stack, 'LogGroup', {
  retentionDays: 7
});
// Configure log group for infinite retention
const logGroup = new LogGroup(stack, 'LogGroup', {
  retentionDays: Infinity
});

Subscriptions and Destinations

Log events matching a particular filter can be sent to either a Lambda function or a Kinesis stream.

If the Kinesis stream lives in a different account, a CrossAccountDestination object needs to be added in the destination account which will act as a proxy for the remote Kinesis stream. This object is automatically created for you if you use the CDK Kinesis library.

Create a SubscriptionFilter, initialize it with an appropriate Pattern (see below) and supply the intended destination:

const fn = new lambda.Function(this, 'Lambda', { ... });
const logGroup = new LogGroup(this, 'LogGroup', { ... });

new SubscriptionFilter(this, 'Subscription', {
    logGroup,
    destination: fn,
    filterPattern: FilterPattern.allTerms("ERROR", "MainThread")
});

Metric Filters

CloudWatch Logs can extract and emit metrics based on a textual log stream. Depending on your needs, this may be a more convenient way of generating metrics for you application than making calls to CloudWatch Metrics yourself.

A MetricFilter either emits a fixed number every time it sees a log event matching a particular pattern (see below), or extracts a number from the log event and uses that as the metric value.

Example:

new MetricFilter(this, 'MetricFilter', {
  logGroup,
  metricNamespace: 'MyApp',
  metricName: 'Latency',
  filterPattern: FilterPattern.exists('$.latency'),
  metricValue: '$.latency'
});

Remember that if you want to use a value from the log event as the metric value, you must mention it in your pattern somewhere.

A very simple MetricFilter can be created by using the logGroup.extractMetric() helper function:

logGroup.extractMetric('$.jsonField', 'Namespace', 'MetricName');

Will extract the value of jsonField wherever it occurs in JSON-structed log records in the LogGroup, and emit them to CloudWatch Metrics under the name Namespace/MetricName.

Patterns

Patterns describe which log events match a subscription or metric filter. There are three types of patterns:

  • Text patterns
  • JSON patterns
  • Space-delimited table patterns

All patterns are constructed by using static functions on the FilterPattern class.

In addition to the patterns above, the following special patterns exist:

  • FilterPattern.allEvents(): matches all log events.
  • FilterPattern.literal(string): if you already know what pattern expression to use, this function takes a string and will use that as the log pattern. For more information, see the Filter and Pattern Syntax.

Text Patterns

Text patterns match if the literal strings appear in the text form of the log line.

  • FilterPattern.allTerms(term, term, ...): matches if all of the given terms (substrings) appear in the log event.
  • FilterPattern.anyTerm(term, term, ...): matches if all of the given terms (substrings) appear in the log event.
  • FilterPattern.anyGroup([term, term, ...], [term, term, ...], ...): matches if all of the terms in any of the groups (specified as arrays) matches. This is an OR match.

Examples:

// Search for lines that contain both "ERROR" and "MainThread"
const pattern1 = FilterPattern.allTerms('ERROR', 'MainThread');

// Search for lines that either contain both "ERROR" and "MainThread", or
// both "WARN" and "Deadlock".
const pattern2 = FilterPattern.anyGroup(
    ['ERROR', 'MainThread'],
    ['WARN', 'Deadlock'],
    );

JSON Patterns

JSON patterns apply if the log event is the JSON representation of an object (without any other characters, so it cannot include a prefix such as timestamp or log level). JSON patterns can make comparisons on the values inside the fields.

  • Strings: the comparison operators allowed for strings are = and !=. String values can start or end with a * wildcard.
  • Numbers: the comparison operators allowed for numbers are =, !=, <, <=, >, >=.

Fields in the JSON structure are identified by identifier the complete object as $ and then descending into it, such as $.field or $.list[0].field.

  • FilterPattern.stringValue(field, comparison, string): matches if the given field compares as indicated with the given string value.
  • FilterPattern.numberValue(field, comparison, number): matches if the given field compares as indicated with the given numerical value.
  • FilterPattern.isNull(field): matches if the given field exists and has the value null.
  • FilterPattern.notExists(field): matches if the given field is not in the JSON structure.
  • FilterPattern.exists(field): matches if the given field is in the JSON structure.
  • FilterPattern.booleanValue(field, boolean): matches if the given field is exactly the given boolean value.
  • FilterPattern.all(jsonPattern, jsonPattern, ...): matches if all of the given JSON patterns match. This makes an AND combination of the given patterns.
  • FilterPattern.any(jsonPattern, jsonPattern, ...): matches if any of the given JSON patterns match. This makes an OR combination of the given patterns.

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.
const pattern = FilterPattern.all(
    FilterPattern.stringValue('$.component', '=', 'HttpServer'),
    FilterPattern.any(
        FilterPattern.booleanValue('$.error', true),
        FilterPattern.numberValue('$.latency', '>', 1000)
    ));

Space-delimited table patterns

If the log events are rows of a space-delimited table, this pattern can be used to identify the columns in that structure and add conditions on any of them. The canonical example where you would apply this type of pattern is Apache server logs.

Text that is surrounded by "..." quotes or [...] square brackets will be treated as one column.

  • FilterPattern.spaceDelimited(column, column, ...): construct a SpaceDelimitedTextPattern object with the indicated columns. The columns map one-by-one the columns found in the log event. The string "..." may be used to specify an arbitrary number of unnamed columns anywhere in the name list (but may only be specified once).

After constructing a SpaceDelimitedTextPattern, you can use the following two members to add restrictions:

  • pattern.whereString(field, comparison, string): add a string condition. The rules are the same as for JSON patterns.
  • pattern.whereNumber(field, comparison, number): add a numerical condition. The rules are the same as for JSON patterns.

Multiple restrictions can be added on the same column; they must all apply.

Example:

// Search for all events where the component is "HttpServer" and the
// result code is not equal to 200.
const pattern = FilterPattern.spaceDelimited('time', 'component', '...', 'result_code', 'latency')
    .whereString('component', '=', 'HttpServer')
    .whereNumber('result_code', '!=', 200);

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.Logs" Version="0.25.3" />

dotnet:

dotnet add package Amazon.CDK.AWS.Logs --version 0.25.3

packages.config:

<package id="Amazon.CDK.AWS.Logs" version="0.25.3" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:logs:jar:0.25.3'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="logs" rev="0.25.3"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>logs</artifactId>
  <version>0.25.3</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:logs:0.25.3'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='logs', version='0.25.3')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-logs@0.25.3

package.json:

{
  "@aws-cdk/aws-logs": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-logs@0.25.3

View in NPM

npm:

$ npm i @aws-cdk/aws-logs@0.25.3

package.json:

{
  "@aws-cdk/aws-logs": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-logs@0.25.3

CfnDestination

class @aws-cdk/aws-logs.CfnDestination(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnDestination;
const { CfnDestination } = require('@aws-cdk/aws-logs');
import { CfnDestination } from '@aws-cdk/aws-logs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
destinationArn
Type:string (readonly)
destinationName
Type:string (readonly)
propertyOverrides
Type:CfnDestinationProps (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnDestinationProps (interface)

class @aws-cdk/aws-logs.CfnDestinationProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnDestinationProps;
// CfnDestinationProps is an interface
import { CfnDestinationProps } from '@aws-cdk/aws-logs';
destinationName

AWS::Logs::Destination.DestinationName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-destinationname

Type:string
destinationPolicy

AWS::Logs::Destination.DestinationPolicy

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-destinationpolicy

Type:string
roleArn

AWS::Logs::Destination.RoleArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-rolearn

Type:string
targetArn

AWS::Logs::Destination.TargetArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-destination.html#cfn-logs-destination-targetarn

Type:string

CfnLogGroup

class @aws-cdk/aws-logs.CfnLogGroup(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnLogGroup;
const { CfnLogGroup } = require('@aws-cdk/aws-logs');
import { CfnLogGroup } from '@aws-cdk/aws-logs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
logGroupArn
Type:string (readonly)
logGroupName
Type:string (readonly)
propertyOverrides
Type:CfnLogGroupProps (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnLogGroupProps (interface)

class @aws-cdk/aws-logs.CfnLogGroupProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnLogGroupProps;
// CfnLogGroupProps is an interface
import { CfnLogGroupProps } from '@aws-cdk/aws-logs';
logGroupName

AWS::Logs::LogGroup.LogGroupName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-cwl-loggroup-loggroupname

Type:string (optional)
retentionInDays

AWS::Logs::LogGroup.RetentionInDays

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#cfn-cwl-loggroup-retentionindays

Type:number or @aws-cdk/cdk.Token (optional)

CfnLogStream

class @aws-cdk/aws-logs.CfnLogStream(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnLogStream;
const { CfnLogStream } = require('@aws-cdk/aws-logs');
import { CfnLogStream } from '@aws-cdk/aws-logs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
logStreamName
Type:string (readonly)
propertyOverrides
Type:CfnLogStreamProps (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnLogStreamProps (interface)

class @aws-cdk/aws-logs.CfnLogStreamProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnLogStreamProps;
// CfnLogStreamProps is an interface
import { CfnLogStreamProps } from '@aws-cdk/aws-logs';
logGroupName

AWS::Logs::LogStream.LogGroupName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html#cfn-logs-logstream-loggroupname

Type:string
logStreamName

AWS::Logs::LogStream.LogStreamName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-logstream.html#cfn-logs-logstream-logstreamname

Type:string (optional)

CfnMetricFilter

class @aws-cdk/aws-logs.CfnMetricFilter(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnMetricFilter;
const { CfnMetricFilter } = require('@aws-cdk/aws-logs');
import { CfnMetricFilter } from '@aws-cdk/aws-logs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
metricFilterName
Type:string (readonly)
propertyOverrides
Type:CfnMetricFilterProps (readonly)
class MetricTransformationProperty

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnMetricFilter.MetricTransformationProperty;
// CfnMetricFilter.MetricTransformationProperty is an interface
import { CfnMetricFilter.MetricTransformationProperty } from '@aws-cdk/aws-logs';
metricName

CfnMetricFilter.MetricTransformationProperty.MetricName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricname

Type:string
metricNamespace

CfnMetricFilter.MetricTransformationProperty.MetricNamespace

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricnamespace

Type:string
metricValue

CfnMetricFilter.MetricTransformationProperty.MetricValue

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-metricvalue

Type:string
defaultValue

CfnMetricFilter.MetricTransformationProperty.DefaultValue

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-defaultvalue

Type:number or @aws-cdk/cdk.Token (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnMetricFilterProps (interface)

class @aws-cdk/aws-logs.CfnMetricFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnMetricFilterProps;
// CfnMetricFilterProps is an interface
import { CfnMetricFilterProps } from '@aws-cdk/aws-logs';
filterPattern

AWS::Logs::MetricFilter.FilterPattern

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-filterpattern

Type:string
logGroupName

AWS::Logs::MetricFilter.LogGroupName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-loggroupname

Type:string
metricTransformations

AWS::Logs::MetricFilter.MetricTransformations

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html#cfn-cwl-metricfilter-metrictransformations

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or MetricTransformationProperty)[]

CfnSubscriptionFilter

class @aws-cdk/aws-logs.CfnSubscriptionFilter(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnSubscriptionFilter;
const { CfnSubscriptionFilter } = require('@aws-cdk/aws-logs');
import { CfnSubscriptionFilter } from '@aws-cdk/aws-logs';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnSubscriptionFilterProps (readonly)
subscriptionFilterName
Type:string (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnSubscriptionFilterProps (interface)

class @aws-cdk/aws-logs.CfnSubscriptionFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CfnSubscriptionFilterProps;
// CfnSubscriptionFilterProps is an interface
import { CfnSubscriptionFilterProps } from '@aws-cdk/aws-logs';
destinationArn

AWS::Logs::SubscriptionFilter.DestinationArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-destinationarn

Type:string
filterPattern

AWS::Logs::SubscriptionFilter.FilterPattern

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-filterpattern

Type:string
logGroupName

AWS::Logs::SubscriptionFilter.LogGroupName

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-loggroupname

Type:string
roleArn

AWS::Logs::SubscriptionFilter.RoleArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html#cfn-cwl-subscriptionfilter-rolearn

Type:string (optional)

ColumnRestriction (interface)

class @aws-cdk/aws-logs.ColumnRestriction

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.ColumnRestriction;
// ColumnRestriction is an interface
import { ColumnRestriction } from '@aws-cdk/aws-logs';
comparison

Comparison operator to use

Type:string
numberValue

Number value to compare to

Exactly one of ‘stringValue’ and ‘numberValue’ must be set.

Type:number (optional)
stringValue

String value to compare to

Exactly one of ‘stringValue’ and ‘numberValue’ must be set.

Type:string (optional)

CrossAccountDestination

class @aws-cdk/aws-logs.CrossAccountDestination(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CrossAccountDestination;
const { CrossAccountDestination } = require('@aws-cdk/aws-logs');
import { CrossAccountDestination } from '@aws-cdk/aws-logs';

A new CloudWatch Logs Destination for use in cross-account scenarios

Log destinations can be used to subscribe a Kinesis stream in a different

account to a CloudWatch Subscription. A Kinesis stream in the same account

can be subscribed directly.

The @aws-cdk/aws-kinesis library takes care of this automatically; you shouldn’t

need to bother with this class.

Extends:

@aws-cdk/cdk.Construct

Implements:

ILogSubscriptionDestination

Parameters:
addToPolicy(statement)
Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
logSubscriptionDestination(_sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Implements @aws-cdk/aws-logs.ILogSubscriptionDestination.logSubscriptionDestination()

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:_sourceLogGroup (ILogGroup) –
Return type:LogSubscriptionDestination
destinationArn

The ARN of this CrossAccountDestination object

Type:string (readonly)
destinationName

The name of this CrossAccountDestination object

Type:string (readonly)
policyDocument

Policy object of this CrossAccountDestination object

Type:@aws-cdk/aws-iam.PolicyDocument (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CrossAccountDestinationProps (interface)

class @aws-cdk/aws-logs.CrossAccountDestinationProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.CrossAccountDestinationProps;
// CrossAccountDestinationProps is an interface
import { CrossAccountDestinationProps } from '@aws-cdk/aws-logs';
role

The role to assume that grants permissions to write to ‘target’.

The role must be assumable by ‘logs.{REGION}.amazonaws.com’.

Type:@aws-cdk/aws-iam.Role
targetArn

The log destination target’s ARN

Type:string
destinationName

The name of the log destination.

Type:string (optional)
Default:Automatically generated

FilterPattern

class @aws-cdk/aws-logs.FilterPattern

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.FilterPattern;
const { FilterPattern } = require('@aws-cdk/aws-logs');
import { FilterPattern } from '@aws-cdk/aws-logs';

A collection of static methods to generate appropriate ILogPatterns

static all(*patterns) → @aws-cdk/aws-logs.JSONPattern

A JSON log pattern that matches if all given JSON log patterns match

Parameters:*patterns (JSONPattern) –
Return type:JSONPattern
static allEvents() → @aws-cdk/aws-logs.IFilterPattern

A log pattern that matches all events.

Return type:IFilterPattern
static allTerms(*terms) → @aws-cdk/aws-logs.IFilterPattern

A log pattern that matches if all the strings given appear in the event.

Parameters:*terms (string) – The words to search for. All terms must match.
Return type:IFilterPattern
static any(*patterns) → @aws-cdk/aws-logs.JSONPattern

A JSON log pattern that matches if any of the given JSON log patterns match

Parameters:*patterns (JSONPattern) –
Return type:JSONPattern
static anyTerm(*terms) → @aws-cdk/aws-logs.IFilterPattern

A log pattern that matches if any of the strings given appear in the event.

Parameters:*terms (string) – The words to search for. Any terms must match.
Return type:IFilterPattern
static anyTermGroup(*termGroups) → @aws-cdk/aws-logs.IFilterPattern

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 (string[]) – A list of term groups to search for. Any one of the clauses must match.
Return type:IFilterPattern
static booleanValue(jsonField, value) → @aws-cdk/aws-logs.JSONPattern

A JSON log pattern that matches if the field exists and equals the boolean value.

Parameters:
  • jsonField (string) – Field inside JSON. Example: “$.myField”
  • value (boolean) – The value to match
Return type:

JSONPattern

static exists(jsonField) → @aws-cdk/aws-logs.JSONPattern

A JSON log patter that matches if the field exists.

This is a readable convenience wrapper over ‘field = *

Parameters:jsonField (string) – Field inside JSON. Example: “$.myField”
Return type:JSONPattern
static isNull(jsonField) → @aws-cdk/aws-logs.JSONPattern

A JSON log pattern that matches if the field exists and has the special value ‘null’.

Parameters:jsonField (string) – Field inside JSON. Example: “$.myField”
Return type:JSONPattern
static literal(logPatternString) → @aws-cdk/aws-logs.IFilterPattern

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 (string) – The pattern string to use.
Return type:IFilterPattern
static notExists(jsonField) → @aws-cdk/aws-logs.JSONPattern

A JSON log pattern that matches if the field does not exist.

Parameters:jsonField (string) – Field inside JSON. Example: “$.myField”
Return type:JSONPattern
static numberValue(jsonField, comparison, value) → @aws-cdk/aws-logs.JSONPattern

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 (string) – Field inside JSON. Example: “$.myField”
  • comparison (string) – Comparison to carry out. One of =, !=, <, <=, >, >=.
  • value (number) – The numerical value to compare to
Return type:

JSONPattern

static spaceDelimited(*columns) → @aws-cdk/aws-logs.SpaceDelimitedTextPattern

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 (string) – The columns in the space-delimited log stream.
Return type:SpaceDelimitedTextPattern
static stringValue(jsonField, comparison, value) → @aws-cdk/aws-logs.JSONPattern

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 (string) – Field inside JSON. Example: “$.myField”
  • comparison (string) – Comparison to carry out. Either = or !=.
  • value (string) – The string value to compare to. May use ‘*’ as wildcard at start or end of string.
Return type:

JSONPattern

IFilterPattern (interface)

class @aws-cdk/aws-logs.IFilterPattern

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.IFilterPattern;
// IFilterPattern is an interface
import { IFilterPattern } from '@aws-cdk/aws-logs';

Interface for objects that can render themselves to log patterns.

logPatternString
Type:string (readonly)

ILogGroup (interface)

class @aws-cdk/aws-logs.ILogGroup

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.ILogGroup;
// ILogGroup is an interface
import { ILogGroup } from '@aws-cdk/aws-logs';
Extends:@aws-cdk/cdk.IConstruct
logGroupArn

The ARN of this log group

Type:string (readonly)
logGroupName

The name of this log group

Type:string (readonly)
export() → @aws-cdk/aws-logs.LogGroupImportProps

Export this LogGroup

Return type:LogGroupImportProps
Abstract:Yes
extractMetric(jsonField, metricNamespace, metricName) → @aws-cdk/aws-cloudwatch.Metric

Extract a metric from structured log events in the LogGroup

Creates a MetricFilter on this LogGroup that will extract the value

of the indicated JSON field in all records where it occurs.

The metric will be available in CloudWatch Metrics under the

indicated namespace and name.

Parameters:
  • jsonField (string) – JSON field to extract (example: ‘$.myfield’)
  • metricNamespace (string) – Namespace to emit the metric under
  • metricName (string) – Name to emit the metric under
Returns:

A Metric object representing the extracted metric

Return type:

@aws-cdk/aws-cloudwatch.Metric

Abstract:

Yes

grant(principal, *actions)

Give the indicated permissions on this log group and all streams

Parameters:
Abstract:

Yes

grantWrite([principal])

Give permissions to write to create and write to streams in this log group

Parameters:principal (@aws-cdk/aws-iam.IPrincipal (optional)) –
Abstract:Yes
newMetricFilter(scope, id, props) → @aws-cdk/aws-logs.MetricFilter

Create a new Metric Filter on this Log Group

Parameters:
Return type:

MetricFilter

Abstract:

Yes

newStream(scope, id[, props]) → @aws-cdk/aws-logs.LogStream

Create a new Log Stream for this Log Group

Parameters:
  • scope (@aws-cdk/cdk.Construct) – Parent construct
  • id (string) – Unique identifier for the construct in its parent
  • props (NewLogStreamProps (optional)) – Properties for creating the LogStream
Return type:

LogStream

Abstract:

Yes

newSubscriptionFilter(scope, id, props) → @aws-cdk/aws-logs.SubscriptionFilter

Create a new Subscription Filter on this Log Group

Parameters:
Return type:

SubscriptionFilter

Abstract:

Yes

node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

ILogStream (interface)

class @aws-cdk/aws-logs.ILogStream

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.ILogStream;
// ILogStream is an interface
import { ILogStream } from '@aws-cdk/aws-logs';
Extends:@aws-cdk/cdk.IConstruct
logStreamName

The name of this log stream

Type:string (readonly)
export() → @aws-cdk/aws-logs.LogStreamImportProps

Export this LogStream

Return type:LogStreamImportProps
Abstract:Yes
node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

ILogSubscriptionDestination (interface)

class @aws-cdk/aws-logs.ILogSubscriptionDestination

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.ILogSubscriptionDestination;
// ILogSubscriptionDestination is an interface
import { ILogSubscriptionDestination } from '@aws-cdk/aws-logs';

Interface for classes that can be the destination of a log Subscription

logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (ILogGroup) –
Return type:LogSubscriptionDestination
Abstract:Yes

JSONPattern

class @aws-cdk/aws-logs.JSONPattern(jsonPatternString)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.JSONPattern;
const { JSONPattern } = require('@aws-cdk/aws-logs');
import { JSONPattern } from '@aws-cdk/aws-logs';

Base class for patterns that only match JSON log events.

Implements:IFilterPattern
Abstract:Yes
Parameters:jsonPatternString (string) –
jsonPatternString
Type:string (readonly)
logPatternString

Implements @aws-cdk/aws-logs.IFilterPattern.logPatternString()

Type:string (readonly)

LogGroup

class @aws-cdk/aws-logs.LogGroup(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogGroup;
const { LogGroup } = require('@aws-cdk/aws-logs');
import { LogGroup } from '@aws-cdk/aws-logs';

Define a CloudWatch Log Group

Extends:

LogGroupBase

Parameters:
static import(scope, id, props) → @aws-cdk/aws-logs.ILogGroup

Import an existing LogGroup

Parameters:
Return type:

ILogGroup

export() → @aws-cdk/aws-logs.LogGroupImportProps

Implements @aws-cdk/aws-logs.LogGroupBase.export()

Export this LogGroup

Return type:LogGroupImportProps
logGroupArn

Implements @aws-cdk/aws-logs.LogGroupBase.logGroupArn()

The ARN of this log group

Type:string (readonly)
logGroupName

Implements @aws-cdk/aws-logs.LogGroupBase.logGroupName()

The name of this log group

Type:string (readonly)
extractMetric(jsonField, metricNamespace, metricName) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-logs.LogGroupBase

Extract a metric from structured log events in the LogGroup

Creates a MetricFilter on this LogGroup that will extract the value

of the indicated JSON field in all records where it occurs.

The metric will be available in CloudWatch Metrics under the

indicated namespace and name.

Parameters:
  • jsonField (string) – JSON field to extract (example: ‘$.myfield’)
  • metricNamespace (string) – Namespace to emit the metric under
  • metricName (string) – Name to emit the metric under
Returns:

A Metric object representing the extracted metric

Return type:

@aws-cdk/aws-cloudwatch.Metric

grant(principal, *actions)

Inherited from @aws-cdk/aws-logs.LogGroupBase

Give the indicated permissions on this log group and all streams

Parameters:
grantWrite([principal])

Inherited from @aws-cdk/aws-logs.LogGroupBase

Give permissions to write to create and write to streams in this log group

Parameters:principal (@aws-cdk/aws-iam.IPrincipal (optional)) –
newMetricFilter(scope, id, props) → @aws-cdk/aws-logs.MetricFilter

Inherited from @aws-cdk/aws-logs.LogGroupBase

Create a new Metric Filter on this Log Group

Parameters:
Return type:

MetricFilter

newStream(scope, id[, props]) → @aws-cdk/aws-logs.LogStream

Inherited from @aws-cdk/aws-logs.LogGroupBase

Create a new Log Stream for this Log Group

Parameters:
  • scope (@aws-cdk/cdk.Construct) – Parent construct
  • id (string) – Unique identifier for the construct in its parent
  • props (NewLogStreamProps (optional)) – Properties for creating the LogStream
Return type:

LogStream

newSubscriptionFilter(scope, id, props) → @aws-cdk/aws-logs.SubscriptionFilter

Inherited from @aws-cdk/aws-logs.LogGroupBase

Create a new Subscription Filter on this Log Group

Parameters:
Return type:

SubscriptionFilter

prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LogGroupBase

class @aws-cdk/aws-logs.LogGroupBase(scope, id)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogGroupBase;
const { LogGroupBase } = require('@aws-cdk/aws-logs');
import { LogGroupBase } from '@aws-cdk/aws-logs';

An CloudWatch Log Group

Extends:

@aws-cdk/cdk.Construct

Implements:

ILogGroup

Abstract:

Yes

Parameters:
  • scope (@aws-cdk/cdk.Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
export() → @aws-cdk/aws-logs.LogGroupImportProps

Implements @aws-cdk/aws-logs.ILogGroup.export()

Export this LogGroup

Return type:LogGroupImportProps
Abstract:Yes
extractMetric(jsonField, metricNamespace, metricName) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-logs.ILogGroup.extractMetric()

Extract a metric from structured log events in the LogGroup

Creates a MetricFilter on this LogGroup that will extract the value

of the indicated JSON field in all records where it occurs.

The metric will be available in CloudWatch Metrics under the

indicated namespace and name.

Parameters:
  • jsonField (string) – JSON field to extract (example: ‘$.myfield’)
  • metricNamespace (string) – Namespace to emit the metric under
  • metricName (string) – Name to emit the metric under
Returns:

A Metric object representing the extracted metric

Return type:

@aws-cdk/aws-cloudwatch.Metric

grant(principal, *actions)

Implements @aws-cdk/aws-logs.ILogGroup.grant()

Give the indicated permissions on this log group and all streams

Parameters:
grantWrite([principal])

Implements @aws-cdk/aws-logs.ILogGroup.grantWrite()

Give permissions to write to create and write to streams in this log group

Parameters:principal (@aws-cdk/aws-iam.IPrincipal (optional)) –
newMetricFilter(scope, id, props) → @aws-cdk/aws-logs.MetricFilter

Implements @aws-cdk/aws-logs.ILogGroup.newMetricFilter()

Create a new Metric Filter on this Log Group

Parameters:
Return type:

MetricFilter

newStream(scope, id[, props]) → @aws-cdk/aws-logs.LogStream

Implements @aws-cdk/aws-logs.ILogGroup.newStream()

Create a new Log Stream for this Log Group

Parameters:
  • scope (@aws-cdk/cdk.Construct) – Parent construct
  • id (string) – Unique identifier for the construct in its parent
  • props (NewLogStreamProps (optional)) – Properties for creating the LogStream
Return type:

LogStream

newSubscriptionFilter(scope, id, props) → @aws-cdk/aws-logs.SubscriptionFilter

Implements @aws-cdk/aws-logs.ILogGroup.newSubscriptionFilter()

Create a new Subscription Filter on this Log Group

Parameters:
Return type:

SubscriptionFilter

logGroupArn

Implements @aws-cdk/aws-logs.ILogGroup.logGroupArn()

The ARN of this log group

Type:string (readonly) (abstract)
logGroupName

Implements @aws-cdk/aws-logs.ILogGroup.logGroupName()

The name of this log group

Type:string (readonly) (abstract)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LogGroupImportProps (interface)

class @aws-cdk/aws-logs.LogGroupImportProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogGroupImportProps;
// LogGroupImportProps is an interface
import { LogGroupImportProps } from '@aws-cdk/aws-logs';

Properties for importing a LogGroup

logGroupArn
Type:string

LogGroupProps (interface)

class @aws-cdk/aws-logs.LogGroupProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogGroupProps;
// LogGroupProps is an interface
import { LogGroupProps } from '@aws-cdk/aws-logs';

Properties for a LogGroup

logGroupName

Name of the log group.

Type:string (optional)
Default:Automatically generated
retainLogGroup

Retain the log group if the stack or containing construct ceases to exist

Normally you want to retain the log group so you can diagnose issues

from logs even after a deployment that no longer includes the log group.

In that case, use the normal date-based retention policy to age out your

logs.

Type:boolean (optional)
Default:true
retentionDays

How long, in days, the log contents will be retained.

To retain all logs, set this value to Infinity.

Type:number (optional)
Default:731 days (2 years)

LogStream

class @aws-cdk/aws-logs.LogStream(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogStream;
const { LogStream } = require('@aws-cdk/aws-logs');
import { LogStream } from '@aws-cdk/aws-logs';

Define a Log Stream in a Log Group

Extends:

@aws-cdk/cdk.Construct

Implements:

ILogStream

Parameters:
static import(scope, id, props) → @aws-cdk/aws-logs.ILogStream

Import an existing LogGroup

Parameters:
Return type:

ILogStream

export() → @aws-cdk/aws-logs.LogStreamImportProps

Implements @aws-cdk/aws-logs.ILogStream.export()

Export this LogStream

Return type:LogStreamImportProps
logStreamName

Implements @aws-cdk/aws-logs.ILogStream.logStreamName()

The name of this log stream

Type:string (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LogStreamImportProps (interface)

class @aws-cdk/aws-logs.LogStreamImportProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogStreamImportProps;
// LogStreamImportProps is an interface
import { LogStreamImportProps } from '@aws-cdk/aws-logs';

Properties for importing a LogStream

logStreamName
Type:string

LogStreamProps (interface)

class @aws-cdk/aws-logs.LogStreamProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogStreamProps;
// LogStreamProps is an interface
import { LogStreamProps } from '@aws-cdk/aws-logs';

Properties for a LogStream

logGroup

The log group to create a log stream for.

Type:ILogGroup
logStreamName

The name of the log stream to create.

The name must be unique within the log group.

Type:string (optional)
Default:Automatically generated
retainLogStream

Retain the log stream if the stack or containing construct ceases to exist

Normally you want to retain the log stream so you can diagnose issues

from logs even after a deployment that no longer includes the log stream.

The date-based retention policy of your log group will age out the logs

after a certain time.

Type:boolean (optional)
Default:true

LogSubscriptionDestination (interface)

class @aws-cdk/aws-logs.LogSubscriptionDestination

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.LogSubscriptionDestination;
// LogSubscriptionDestination is an interface
import { LogSubscriptionDestination } from '@aws-cdk/aws-logs';

Properties returned by a Subscription destination

arn

The ARN of the subscription’s destination

Type:string (readonly)
role

The role to assume to write log events to the destination

Type:@aws-cdk/aws-iam.Role (optional) (readonly)
Default:No role assumed

MetricFilter

class @aws-cdk/aws-logs.MetricFilter(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.MetricFilter;
const { MetricFilter } = require('@aws-cdk/aws-logs');
import { MetricFilter } from '@aws-cdk/aws-logs';

A filter that extracts information from CloudWatch Logs and emits to CloudWatch Metrics

Extends:

@aws-cdk/cdk.Construct

Parameters:
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

MetricFilterProps (interface)

class @aws-cdk/aws-logs.MetricFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.MetricFilterProps;
// MetricFilterProps is an interface
import { MetricFilterProps } from '@aws-cdk/aws-logs';

Properties for a MetricFilter

filterPattern

Pattern to search for log events.

Type:IFilterPattern
logGroup

The log group to create the filter on.

Type:ILogGroup
metricName

The name of the metric to emit.

Type:string
metricNamespace

The namespace of the metric to emit.

Type:string
defaultValue

The value to emit if the pattern does not match a particular event.

Type:number (optional)
Default:No metric emitted.
metricValue

The value to emit for the metric.

Can either be a literal number (typically “1”), or the name of a field in the structure

to take the value from the matched event. If you are using a field value, the field

value must have been matched using the pattern.

If you want to specify a field from a matched JSON structure, use ‘$.fieldName’,

and make sure the field is in the pattern (if only as ‘$.fieldName = *’).

If you want to specify a field from a matched space-delimited structure,

use ‘$fieldName’.

Type:string (optional)
Default:“1”

NewLogStreamProps (interface)

class @aws-cdk/aws-logs.NewLogStreamProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.NewLogStreamProps;
// NewLogStreamProps is an interface
import { NewLogStreamProps } from '@aws-cdk/aws-logs';

Properties for a new LogStream created from a LogGroup

logStreamName

The name of the log stream to create.

The name must be unique within the log group.

Type:string (optional)
Default:Automatically generated

NewMetricFilterProps (interface)

class @aws-cdk/aws-logs.NewMetricFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.NewMetricFilterProps;
// NewMetricFilterProps is an interface
import { NewMetricFilterProps } from '@aws-cdk/aws-logs';

Properties for a MetricFilter created from a LogGroup

filterPattern

Pattern to search for log events.

Type:IFilterPattern
metricName

The name of the metric to emit.

Type:string
metricNamespace

The namespace of the metric to emit.

Type:string
defaultValue

The value to emit if the pattern does not match a particular event.

Type:number (optional)
Default:No metric emitted.
metricValue

The value to emit for the metric.

Can either be a literal number (typically “1”), or the name of a field in the structure

to take the value from the matched event. If you are using a field value, the field

value must have been matched using the pattern.

If you want to specify a field from a matched JSON structure, use ‘$.fieldName’,

and make sure the field is in the pattern (if only as ‘$.fieldName = *’).

If you want to specify a field from a matched space-delimited structure,

use ‘$fieldName’.

Type:string (optional)
Default:“1”

NewSubscriptionFilterProps (interface)

class @aws-cdk/aws-logs.NewSubscriptionFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.NewSubscriptionFilterProps;
// NewSubscriptionFilterProps is an interface
import { NewSubscriptionFilterProps } from '@aws-cdk/aws-logs';

Properties for a new SubscriptionFilter created from a LogGroup

destination

The destination to send the filtered events to.

For example, a Kinesis stream or a Lambda function.

Type:ILogSubscriptionDestination
filterPattern

Log events matching this pattern will be sent to the destination.

Type:IFilterPattern

SpaceDelimitedTextPattern

class @aws-cdk/aws-logs.SpaceDelimitedTextPattern(columns, restrictions)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.SpaceDelimitedTextPattern;
const { SpaceDelimitedTextPattern } = require('@aws-cdk/aws-logs');
import { SpaceDelimitedTextPattern } from '@aws-cdk/aws-logs';

Space delimited text pattern

Implements:

IFilterPattern

Parameters:
static construct(columns) → @aws-cdk/aws-logs.SpaceDelimitedTextPattern

Construct a new instance of a space delimited text pattern

Since this class must be public, we can’t rely on the user only creating it through

the LogPattern.spaceDelimited() factory function. We must therefore validate the

argument in the constructor. Since we’re returning a copy on every mutation, and we

don’t want to re-validate the same things on every construction, we provide a limited

set of mutator functions and only validate the new data every time.

Parameters:columns (string[]) –
Return type:SpaceDelimitedTextPattern
whereNumber(columnName, comparison, value) → @aws-cdk/aws-logs.SpaceDelimitedTextPattern

Restrict where the pattern applies

Parameters:
  • columnName (string) –
  • comparison (string) –
  • value (number) –
Return type:

SpaceDelimitedTextPattern

whereString(columnName, comparison, value) → @aws-cdk/aws-logs.SpaceDelimitedTextPattern

Restrict where the pattern applies

Parameters:
  • columnName (string) –
  • comparison (string) –
  • value (string) –
Return type:

SpaceDelimitedTextPattern

columns
Type:string[] (readonly)
logPatternString

Implements @aws-cdk/aws-logs.IFilterPattern.logPatternString()

Type:string (readonly)
restrictions
Type:string => ColumnRestriction[] (readonly)

SubscriptionFilter

class @aws-cdk/aws-logs.SubscriptionFilter(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.SubscriptionFilter;
const { SubscriptionFilter } = require('@aws-cdk/aws-logs');
import { SubscriptionFilter } from '@aws-cdk/aws-logs';

A new Subscription on a CloudWatch log group.

Extends:

@aws-cdk/cdk.Construct

Parameters:
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

SubscriptionFilterProps (interface)

class @aws-cdk/aws-logs.SubscriptionFilterProps

Language-specific names:

using Amazon.CDK.AWS.Logs;
import software.amazon.awscdk.services.logs.SubscriptionFilterProps;
// SubscriptionFilterProps is an interface
import { SubscriptionFilterProps } from '@aws-cdk/aws-logs';

Properties for a SubscriptionFilter

destination

The destination to send the filtered events to.

For example, a Kinesis stream or a Lambda function.

Type:ILogSubscriptionDestination
filterPattern

Log events matching this pattern will be sent to the destination.

Type:IFilterPattern
logGroup

The log group to create the subscription on.

Type:ILogGroup