# Amazon 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
one of the values in the [`RetentionDays`](/v2/docs/aws-cdk-lib.aws_logs.RetentionDays) enum to configure a different
retention period (including infinite retention).

```ts
// Configure log group for short retention
const logGroup = new LogGroup(stack, 'LogGroup', {
  retention: RetentionDays.ONE_WEEK,
});
// Configure log group for infinite retention
const logGroup = new LogGroup(stack, 'LogGroup', {
  retention: Infinity,
});
```

## LogRetention

The [`LogRetention`](/v2/docs/aws-cdk-lib.aws_logs.LogRetention) construct is a way to control the retention period of log groups that are created outside of the CDK. The construct is usually
used on log groups that are auto created by AWS services, such as [AWS
lambda](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html).

This is implemented using a [CloudFormation custom
resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html)
which pre-creates the log group if it doesn't exist, and sets the specified log retention period (never expire, by default).

By default, the log group will be created in the same region as the stack. The `logGroupRegion` property can be used to configure
log groups in other regions. This is typically useful when controlling retention for log groups auto-created by global services that
publish their log group to a specific region, such as AWS Chatbot creating a log group in `us-east-1`.

By default, the log group created by LogRetention will be retained after the stack is deleted. If the RemovalPolicy is set to DESTROY, then the log group will be deleted when the stack is deleted.

## Log Group Class

CloudWatch Logs offers three classes of log groups:

1. The CloudWatch Logs Standard log class is a full-featured option for logs that require real-time monitoring or logs that you access frequently.

2. The CloudWatch Logs Infrequent Access log class is a new log class that you can use to cost-effectively consolidate your logs. This log class offers a subset of CloudWatch Logs capabilities including managed ingestion, storage, cross-account log analytics, and encryption with a lower ingestion price per GB. The Infrequent Access log class is ideal for ad-hoc querying and after-the-fact forensic analysis on infrequently accessed logs.

3. The CloudWatch Logs Delivery log class is used to deliver logs to a destination such as Amazon S3 or Amazon Data Firehose (for example, Lambda vended logs). A Delivery log group does not store log events itself; it forwards them to a destination configured through a subscription filter. Because of this, the Delivery log class does not support `retention`, `dataProtectionPolicy`, or `fieldIndexPolicies`; setting any of them together with `LogGroupClass.DELIVERY` results in a synthesis-time error.

```ts
new logs.LogGroup(this, 'DeliveryLogGroup', {
  logGroupClass: logs.LogGroupClass.DELIVERY,
});
```

For more details please check: [log group class documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html)

## Resource Policy

CloudWatch Resource Policies allow other AWS services or IAM Principals to put log events into the log groups.
A resource policy is automatically created when `addToResourcePolicy` is called on the LogGroup for the first time:

```ts
const logGroup = new logs.LogGroup(this, 'LogGroup');
logGroup.addToResourcePolicy(new iam.PolicyStatement({
    actions: ['logs:CreateLogStream', 'logs:PutLogEvents'],
    principals: [new iam.ServicePrincipal('es.amazonaws.com')],
    resources: [logGroup.logGroupArn],
}));
```

Or more conveniently, write permissions to the log group can be granted as follows which gives same result as in the above example.

```ts
const logGroup = new logs.LogGroup(this, 'LogGroup');
logGroup.grants.write(new iam.ServicePrincipal('es.amazonaws.com'));
```

Similarly, read permissions can be granted to the log group as follows.

```ts
const logGroup = new logs.LogGroup(this, 'LogGroup');
logGroup.grants.read(new iam.ServicePrincipal('es.amazonaws.com'));
```

Be aware that any ARNs or tokenized values passed to the resource policy will be converted into AWS Account IDs.
This is because CloudWatch Logs Resource Policies do not accept ARNs as principals, but they do accept
Account ID strings. Non-ARN principals, like Service principals or Any principals, are accepted by CloudWatch.

## Encrypting Log Groups

By default, log group data is always encrypted in CloudWatch Logs. You have the
option to encrypt log group data using a AWS KMS customer master key (CMK) should
you not wish to use the default AWS encryption. Keep in mind that if you decide to
encrypt a log group, any service or IAM identity that needs to read the encrypted
log streams in the future will require the same CMK to decrypt the data.

Here's a simple example of creating an encrypted Log Group using a KMS CMK.

```ts
import * as kms from 'aws-cdk-lib/aws-kms';

new logs.LogGroup(this, 'LogGroup', {
  encryptionKey: new kms.Key(this, 'Key'),
});
```

See the AWS documentation for more detailed information about [encrypting CloudWatch
Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html).

## 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`](/v2/docs/aws-cdk-lib.aws_logs.CrossAccountDestination)
object must be explicitly created in the destination account which will act as a proxy
for the remote Kinesis stream.

Note: The aws-cdk-lib/aws-logs-destinations KinesisDestination construct does not automatically create a CrossAccountDestination for cross-account scenarios.

Create a [`SubscriptionFilter`](/v2/docs/aws-cdk-lib.aws_logs.SubscriptionFilter), initialize it with an appropriate `Pattern` (see
below) and supply the intended destination:

```ts
import * as destinations from 'aws-cdk-lib/aws-logs-destinations';

declare const fn: lambda.Function;
declare const logGroup: logs.LogGroup;

new logs.SubscriptionFilter(this, 'Subscription', {
  logGroup,
  destination: new destinations.LambdaDestination(fn),
  filterPattern: logs.FilterPattern.allTerms("ERROR", "MainThread"),
  filterName: 'ErrorInMainThread',
});
```

When you use `KinesisDestination`, you can choose the method used to
distribute log data to the destination by setting the `distribution` property.

```ts
import * as destinations from 'aws-cdk-lib/aws-logs-destinations';
import * as kinesis from 'aws-cdk-lib/aws-kinesis';

declare const stream: kinesis.Stream;
declare const logGroup: logs.LogGroup;

new logs.SubscriptionFilter(this, 'Subscription', {
  logGroup,
  destination: new destinations.KinesisDestination(stream),
  filterPattern: logs.FilterPattern.allTerms("ERROR", "MainThread"),
  filterName: 'ErrorInMainThread',
  distribution: logs.Distribution.RANDOM,
});
```

When you use `FirehoseDestination`, you can choose the method used to
distribute log data to the destination by setting the `distribution` property.

```ts
import * as destinations from 'aws-cdk-lib/aws-logs-destinations';
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';

declare const deliveryStream: firehose.IDeliveryStream;
declare const logGroup: logs.LogGroup;

new logs.SubscriptionFilter(this, 'Subscription', {
  logGroup,
  destination: new destinations.FirehoseDestination(deliveryStream),
  filterPattern: logs.FilterPattern.allEvents(),
});
```

## 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`](/v2/docs/aws-cdk-lib.aws_logs.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:

```ts
new MetricFilter(this, 'MetricFilter', {
  logGroup,
  metricNamespace: 'MyApp',
  metricName: 'Latency',
  filterPattern: FilterPattern.all(
    FilterPattern.exists('$.latency'),
    FilterPattern.regexValue('$.message', '=', 'bind: address already in use'),
  ),
  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:

```ts
declare const logGroup: logs.LogGroup;
logGroup.extractMetric('$.jsonField', 'Namespace', 'MetricName');
```

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

### Exposing Metric on a Metric Filter

You can expose a metric on a metric filter by calling the `MetricFilter.metric()` API.
This has a default of `statistic = 'avg'` if the statistic is not set in the `props`.

```ts
declare const logGroup: logs.LogGroup;
const mf = new logs.MetricFilter(this, 'MetricFilter', {
  logGroup,
  metricNamespace: 'MyApp',
  metricName: 'Latency',
  filterPattern: logs.FilterPattern.exists('$.latency'),
  metricValue: '$.latency',
  dimensions: {
    ErrorCode: '$.errorCode',
  },
  unit: cloudwatch.Unit.MILLISECONDS,
});

//expose a metric from the metric filter
const metric = mf.metric();

//you can use the metric to create a new alarm
new cloudwatch.Alarm(this, 'alarm from metric filter', {
  metric,
  threshold: 100,
  evaluationPeriods: 2,
});
```

### Metrics for IncomingLogs and IncomingBytes
Metric methods have been defined for IncomingLogs and IncomingBytes within LogGroups. These metrics allow for the creation of alarms on log ingestion, ensuring that the log ingestion process is functioning correctly.

To define an alarm based on these metrics, you can use the following template:

```ts
const logGroup = new logs.LogGroup(this, 'MyLogGroup');
const incomingEventsMetric = logGroup.metricIncomingLogEvents();
new cloudwatch.Alarm(this, 'HighLogVolumeAlarm', {
  metric: incomingEventsMetric,
  threshold: 1000,
  evaluationPeriods: 1,
});
```

```ts
const logGroup = new logs.LogGroup(this, 'MyLogGroup');
const incomingBytesMetric = logGroup.metricIncomingBytes();
new cloudwatch.Alarm(this, 'HighDataVolumeAlarm', {
  metric: incomingBytesMetric,
  threshold: 5000000,  // 5 MB
  evaluationPeriods: 1,
});
```

## 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`](/v2/docs/aws-cdk-lib.aws_logs.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](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html).

### 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.anyTermGroup([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:

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

// Search for lines that either contain both "ERROR" and "MainThread", or
// both "WARN" and "Deadlock".
const pattern2 = logs.FilterPattern.anyTermGroup(
  ['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.regexValue(field, comparison, string)`: matches if the given
  field compares as indicated with the given regex pattern.
* `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:

```ts
// 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 = logs.FilterPattern.all(
  logs.FilterPattern.stringValue('$.component', '=', 'HttpServer'),
  logs.FilterPattern.any(
    logs.FilterPattern.booleanValue('$.error', true),
    logs.FilterPattern.numberValue('$.latency', '>', 1000),
  ),
  logs.FilterPattern.regexValue('$.message', '=', 'bind address already in use'),
);
```

## 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`](/v2/docs/aws-cdk-lib.aws_logs.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`](/v2/docs/aws-cdk-lib.aws_logs.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:

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

## Logs Insights Query Definition

Creates a query definition for CloudWatch Logs Insights.

Example:

```ts
new logs.QueryDefinition(this, 'QueryDefinition', {
  queryDefinitionName: 'MyQuery',
  queryString: new logs.QueryString({
    fields: ['@timestamp', '@message'],
    parseStatements: [
      '@message "[*] *" as loggingType, loggingMessage',
      '@message "<*>: *" as differentLoggingType, differentLoggingMessage',
    ],
    filterStatements: [
      'loggingType = "ERROR"',
      'loggingMessage = "A very strange error occurred!"',
    ],
    statsStatements: [
      'count(loggingMessage) as loggingErrors',
      'count(differentLoggingMessage) as differentLoggingErrors',
    ],
    sort: '@timestamp desc',
    limit: 20,
  }),
});
```

## Data Protection Policy

Creates a data protection policy and assigns it to the log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data. When a user who does not have permission to view masked data views a log event that includes masked data, the sensitive data is replaced by asterisks.

For more information, see [Protect sensitive log data with masking](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html).

For a list of types of managed identifiers that can be audited and masked, see [Types of data that you can protect](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/protect-sensitive-log-data-types.html).

If a new identifier is supported but not yet in the `DataIdentifiers` enum, the name of the identifier can be supplied as `name` in the constructor instead.

To add a custom data identifier, supply a custom `name` and `regex` to the `CustomDataIdentifiers` constructor.
For more information on custom data identifiers, see [Custom data identifiers](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL-custom-data-identifiers.html).

Each policy may consist of a log group, S3 bucket, and/or Firehose delivery stream audit destination.

Example:

```ts
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';

const logGroupDestination = new logs.LogGroup(this, 'LogGroupLambdaAudit', {
  logGroupName: 'auditDestinationForCDK',
});

const bucket = new s3.Bucket(this, 'audit-bucket');
const s3Destination = new firehose.S3Bucket(bucket);

const deliveryStream = new firehose.DeliveryStream(this, 'Delivery Stream', {
  destination: s3Destination,
});

const dataProtectionPolicy = new logs.DataProtectionPolicy({
  name: 'data protection policy',
  description: 'policy description',
  identifiers: [
    logs.DataIdentifier.DRIVERSLICENSE_US, // managed data identifier
    new logs.DataIdentifier('EmailAddress'), // forward compatibility for new managed data identifiers
    new logs.CustomDataIdentifier('EmployeeId', 'EmployeeId-\\d{9}')], // custom data identifier
  logGroupAuditDestination: logGroupDestination,
  s3BucketAuditDestination: bucket,
  deliveryStreamNameAuditDestination: deliveryStream.deliveryStreamName,
});

new logs.LogGroup(this, 'LogGroupLambda', {
  logGroupName: 'cdkIntegLogGroup',
  dataProtectionPolicy: dataProtectionPolicy,
});
```

## Configure Deletion Protection

Indicates whether deletion protection is enabled for this log group. When enabled, deletion protection blocks all deletion operations until it is explicitly disabled.

For more information, see [Protecting log groups from deletion](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/protecting-log-groups-from-deletion.html).

```ts
new logs.LogGroup(this, 'LogGroup', {
  deletionProtectionEnabled: true,
});
```

## Field Index Policies

Creates or updates a field index policy for the specified log group. You can use field index policies to create field indexes on fields found in log events in the log group. Creating field indexes lowers the costs for CloudWatch Logs Insights queries that reference those field indexes, because these queries attempt to skip the processing of log events that are known to not match the indexed field. Good fields to index are fields that you often need to query for and fields that have high cardinality of values.

For more information, see [Create field indexes to improve query performance and reduce costs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs-Field-Indexing.html).

Only log groups in the Standard log class support field index policies.
Currently, this array supports only one field index policy object.

Example:

```ts

const fieldIndexPolicy = new logs.FieldIndexPolicy({
  fields: ['Operation', 'RequestId'],
});

new logs.LogGroup(this, 'LogGroup', {
  logGroupName: 'cdkIntegLogGroup',
  fieldIndexPolicies: [fieldIndexPolicy],
});
```

## Transformer

A log transformer enables transforming log events into a different format, making them easier
to process and analyze. You can transform logs from different sources into standardized formats
that contain relevant, source-specific information. Transformations are performed at the time of log ingestion.
Transformers support several types of processors which can be chained into a processing pipeline (subject to some restrictions, see [Usage Limits](#usage-limits)).

### Processor Types

1. **Parser Processors**: Parse string log events into structured log events. These are configurable parsers created using [`ParserProcessor`](/v2/docs/aws-cdk-lib.aws_logs.ParserProcessor), and support conversion to a format like Json, extracting fields from CSV input, converting vended sources to [OCSF](https://schema.ocsf.io/1.1.0/) format, regex parsing using Grok patterns or key-value parsing. Refer [configurable parsers](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-Configurable) for more examples.

2. **Vended Log Parsers**: Parse log events from vended sources into structured log events. These are created using [`VendedLogParser`](/v2/docs/aws-cdk-lib.aws_logs.VendedLogParser), and support conversion from sources such as AWS WAF, PostGres, Route53, CloudFront and VPC. These parsers are not configurable, meaning these can be added to the pipeline but do not accept any properties or configurations. Refer [vended log parsers](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-BuiltIn) for more examples.

3. **String Mutators**: Perform operations on string values in a field of a log event and are created using [`StringMutatorProcessor`](/v2/docs/aws-cdk-lib.aws_logs.StringMutatorProcessor). These can be used to format string values in the log event such as changing case, removing trailing whitespaces or extracting values from a string field by splitting the string or regex backreferences. Refer [string mutators](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-StringMutate) for more examples.

4. **JSON Mutators**: Perform operation on JSON log events and are created using [`JsonMutatorProcessor`](/v2/docs/aws-cdk-lib.aws_logs.JsonMutatorProcessor). These processors can be used to enrich log events by adding new fields, deleting, moving, renaming fields, copying values to other fields or converting a list of key-value pairs to a map. Refer [JSON mutators](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-JSONMutate) for more examples.

5. **Data Converters**: Convert the data into different formats and are created using [`DataConverterProcessor`](/v2/docs/aws-cdk-lib.aws_logs.DataConverterProcessor). These can be used to convert values in a field to datatypes such as integers, string, double and boolean or to convert dates and times to different formats. Refer [datatype processors](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-Datatype) for more examples.

### Usage Limits

- A transformer can have a maximum of 20 processors
- At least one parser-type processor is required
- Maximum of 5 parser-type processors allowed
- AWS vended log parser (if used) must be the first processor
- Only one parseToOcsf processor, one grok processor, one addKeys processor, and one copyValue processor allowed per transformer
- Transformers can only be used with log groups in the Standard log class

Example:

```ts

// Create a log group
const logGroup = new logs.LogGroup(this, 'MyLogGroup');

// Create a JSON parser processor
const jsonParser = new logs.ParserProcessor({
  type: logs.ParserProcessorType.JSON
});

// Create a processor to add keys
const addKeysProcessor = new logs.JsonMutatorProcessor({
  type: logs.JsonMutatorType.ADD_KEYS,
  addKeysOptions: {
    entries: [{
      key: 'metadata.transformed_in',
      value: 'CloudWatchLogs'
    }]
  }
});

// Create a transformer with these processors
new logs.Transformer(this, 'Transformer', {
  transformerName: 'MyTransformer',
  logGroup: logGroup,
  transformerConfig: [jsonParser, addKeysProcessor]
});
```

For more details on CloudWatch Logs transformation processors, refer to the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html).

### Usage of metric filters on transformed logs

In order to use the transformed logs as search pattern, set the parameter `applyOnTransformedLogs: true` in the MetricFilterProps.

## Notes

Be aware that Log Group ARNs will always have the string `:*` appended to
them, to match the behavior of [the CloudFormation `AWS::Logs::LogGroup`
resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#aws-resource-logs-loggroup-return-values).

## Types

| Name | Kind | Summary |
| --- | --- | --- |
| [`CrossAccountDestination`](/v2/docs/aws-cdk-lib.aws_logs.CrossAccountDestination) | Construct (L2) | A new CloudWatch Logs Destination for use in cross-account scenarios. |
| [`LogGroup`](/v2/docs/aws-cdk-lib.aws_logs.LogGroup) | Construct (L2) | Define a CloudWatch Log Group. |
| [`LogStream`](/v2/docs/aws-cdk-lib.aws_logs.LogStream) | Construct (L2) | Define a Log Stream in a Log Group. |
| [`MetricFilter`](/v2/docs/aws-cdk-lib.aws_logs.MetricFilter) | Construct (L2) | A filter that extracts information from CloudWatch Logs and emits to CloudWatch Metrics. |
| [`QueryDefinition`](/v2/docs/aws-cdk-lib.aws_logs.QueryDefinition) | Construct (L2) | Define a query definition for CloudWatch Logs Insights. |
| [`ResourcePolicy`](/v2/docs/aws-cdk-lib.aws_logs.ResourcePolicy) | Construct (L2) | Resource Policy for CloudWatch Log Groups. |
| [`SubscriptionFilter`](/v2/docs/aws-cdk-lib.aws_logs.SubscriptionFilter) | Construct (L2) | A new Subscription on a CloudWatch log group. |
| [`Transformer`](/v2/docs/aws-cdk-lib.aws_logs.Transformer) | Construct (L2) | Represent the L2 construct for the AWS::Logs::Transformer CloudFormation resource. |
| [`CfnAccountPolicy`](/v2/docs/aws-cdk-lib.aws_logs.CfnAccountPolicy) | Construct (L1) | Creates or updates an account-level data protection policy or subscription filter policy that applies to all log groups or a subset of log groups in the account. |
| [`CfnDelivery`](/v2/docs/aws-cdk-lib.aws_logs.CfnDelivery) | Construct (L1) | This structure contains information about one *delivery* in your account. |
| [`CfnDeliveryDestination`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliveryDestination) | Construct (L1) | This structure contains information about one *delivery destination* in your account. |
| [`CfnDeliverySource`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliverySource) | Construct (L1) | Creates or updates one *delivery source* in your account. |
| [`CfnDestination`](/v2/docs/aws-cdk-lib.aws_logs.CfnDestination) | Construct (L1) | The AWS::Logs::Destination resource specifies a CloudWatch Logs destination. |
| [`CfnIntegration`](/v2/docs/aws-cdk-lib.aws_logs.CfnIntegration) | Construct (L1) | Creates an integration between CloudWatch Logs and another service in this account. |
| [`CfnLogAnomalyDetector`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogAnomalyDetector) | Construct (L1) | Creates or updates an *anomaly detector* that regularly scans one or more log groups and look for patterns and anomalies in the logs. |
| [`CfnLogGroup`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogGroup) | Construct (L1) | The `AWS::Logs::LogGroup` resource specifies a log group. |
| [`CfnLogStream`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogStream) | Construct (L1) | The `AWS::Logs::LogStream` resource specifies an Amazon CloudWatch Logs log stream in a specific log group. |
| [`CfnMetricFilter`](/v2/docs/aws-cdk-lib.aws_logs.CfnMetricFilter) | Construct (L1) | The `AWS::Logs::MetricFilter` resource specifies a metric filter that describes how CloudWatch Logs extracts information from logs and transforms it into Amazon CloudWatch metrics. |
| [`CfnQueryDefinition`](/v2/docs/aws-cdk-lib.aws_logs.CfnQueryDefinition) | Construct (L1) | Creates a query definition for CloudWatch Logs Insights. |
| [`CfnResourcePolicy`](/v2/docs/aws-cdk-lib.aws_logs.CfnResourcePolicy) | Construct (L1) | Creates or updates a resource policy that allows other AWS services to put log events to this account. |
| [`CfnScheduledQuery`](/v2/docs/aws-cdk-lib.aws_logs.CfnScheduledQuery) | Construct (L1) | Creates a new Scheduled Query that allows you to define a Logs Insights query that will run on a schedule and configure actions to take with the query results. |
| [`CfnStorageTierPolicy`](/v2/docs/aws-cdk-lib.aws_logs.CfnStorageTierPolicy) | Construct (L1) | Resource Type definition for AWS::Logs::StorageTierPolicy. |
| [`CfnSubscriptionFilter`](/v2/docs/aws-cdk-lib.aws_logs.CfnSubscriptionFilter) | Construct (L1) | The `AWS::Logs::SubscriptionFilter` resource specifies a subscription filter and associates it with the specified log group. |
| [`CfnTransformer`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer) | Construct (L1) | Creates or updates a *log transformer* for a single log group. |
| [`AddKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.AddKeyEntryProperty) | Struct | This object defines one key that will be added with the addKeys processor. |
| [`AddKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.AddKeysProperty) | Struct | This processor adds new key-value pairs to the log event. |
| [`BaseProcessorProps`](/v2/docs/aws-cdk-lib.aws_logs.BaseProcessorProps) | Struct | Base properties for all processor types. |
| [`CfnAccountPolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnAccountPolicyProps) | Struct | Properties for defining a `CfnAccountPolicy`. |
| [`CfnDeliveryDestination.DestinationPolicyProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliveryDestination.DestinationPolicyProperty) | Struct | An IAM policy that grants permissions to CloudWatch Logs to deliver logs cross-account to a specified destination in this account. |
| [`CfnDeliveryDestinationProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliveryDestinationProps) | Struct | Properties for defining a `CfnDeliveryDestination`. |
| [`CfnDeliveryProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliveryProps) | Struct | Properties for defining a `CfnDelivery`. |
| [`CfnDeliverySourceProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnDeliverySourceProps) | Struct | Properties for defining a `CfnDeliverySource`. |
| [`CfnDestinationProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnDestinationProps) | Struct | Properties for defining a `CfnDestination`. |
| [`CfnIntegration.OpenSearchResourceConfigProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnIntegration.OpenSearchResourceConfigProperty) | Struct | This structure contains configuration details about an integration between CloudWatch Logs and OpenSearch Service. |
| [`CfnIntegration.ResourceConfigProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnIntegration.ResourceConfigProperty) | Struct | This structure contains configuration details about an integration between CloudWatch Logs and another entity. |
| [`CfnIntegrationProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnIntegrationProps) | Struct | Properties for defining a `CfnIntegration`. |
| [`CfnLogAnomalyDetectorProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogAnomalyDetectorProps) | Struct | Properties for defining a `CfnLogAnomalyDetector`. |
| [`CfnLogGroupProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogGroupProps) | Struct | Properties for defining a `CfnLogGroup`. |
| [`CfnLogStreamProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnLogStreamProps) | Struct | Properties for defining a `CfnLogStream`. |
| [`CfnMetricFilter.DimensionProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnMetricFilter.DimensionProperty) | Struct | Specifies the CloudWatch metric dimensions to publish with this metric. |
| [`CfnMetricFilter.MetricTransformationProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnMetricFilter.MetricTransformationProperty) | Struct | `MetricTransformation` is a property of the `AWS::Logs::MetricFilter` resource that describes how to transform log streams into a CloudWatch metric. |
| [`CfnMetricFilterProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnMetricFilterProps) | Struct | Properties for defining a `CfnMetricFilter`. |
| [`CfnQueryDefinition.QueryParameterProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnQueryDefinition.QueryParameterProperty) | Struct | This structure defines a query parameter for a saved CloudWatch Logs Insights query definition. |
| [`CfnQueryDefinitionProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnQueryDefinitionProps) | Struct | Properties for defining a `CfnQueryDefinition`. |
| [`CfnResourcePolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnResourcePolicyProps) | Struct | Properties for defining a `CfnResourcePolicy`. |
| [`CfnScheduledQuery.DestinationConfigurationProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnScheduledQuery.DestinationConfigurationProperty) | Struct |  |
| [`CfnScheduledQuery.S3ConfigurationProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnScheduledQuery.S3ConfigurationProperty) | Struct |  |
| [`CfnScheduledQuery.TagsItemsProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnScheduledQuery.TagsItemsProperty) | Struct |  |
| [`CfnScheduledQueryProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnScheduledQueryProps) | Struct | Properties for defining a `CfnScheduledQuery`. |
| [`CfnStorageTierPolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnStorageTierPolicyProps) | Struct | Properties for defining a `CfnStorageTierPolicy`. |
| [`CfnSubscriptionFilterProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnSubscriptionFilterProps) | Struct | Properties for defining a `CfnSubscriptionFilter`. |
| [`CfnTransformer.AddKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.AddKeyEntryProperty) | Struct | This object defines one key that will be added with the [addKeys](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-addKey) processor. |
| [`CfnTransformer.AddKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.AddKeysProperty) | Struct | This processor adds new key-value pairs to the log event. |
| [`CfnTransformer.CopyValueEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.CopyValueEntryProperty) | Struct | This object defines one value to be copied with the [copyValue](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-copyValue) processor. |
| [`CfnTransformer.CopyValueProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.CopyValueProperty) | Struct | This processor copies values within a log event. |
| [`CfnTransformer.CsvProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.CsvProperty) | Struct | The `CSV` processor parses comma-separated values (CSV) from the log events into columns. |
| [`CfnTransformer.DateTimeConverterProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.DateTimeConverterProperty) | Struct | This processor converts a datetime string into a format that you specify. |
| [`CfnTransformer.DeleteKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.DeleteKeysProperty) | Struct | This processor deletes entries from a log event. These entries are key-value pairs. |
| [`CfnTransformer.GrokProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.GrokProperty) | Struct | This processor uses pattern matching to parse and structure unstructured data. |
| [`CfnTransformer.ListToMapProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ListToMapProperty) | Struct | This processor takes a list of objects that contain key fields, and converts them into a map of target keys. |
| [`CfnTransformer.LowerCaseStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.LowerCaseStringProperty) | Struct | This processor converts a string to lowercase. |
| [`CfnTransformer.MoveKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.MoveKeyEntryProperty) | Struct | This object defines one key that will be moved with the [moveKey](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation.html#CloudWatch-Logs-Transformation-moveKey) processor. |
| [`CfnTransformer.MoveKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.MoveKeysProperty) | Struct | This processor moves a key from one field to another. The original key is deleted. |
| [`CfnTransformer.ParseCloudfrontProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseCloudfrontProperty) | Struct | This processor parses CloudFront vended logs, extract fields, and convert them into JSON format. |
| [`CfnTransformer.ParseJSONProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseJSONProperty) | Struct | This processor parses log events that are in JSON format. |
| [`CfnTransformer.ParseKeyValueProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseKeyValueProperty) | Struct | This processor parses a specified field in the original log event into key-value pairs. |
| [`CfnTransformer.ParsePostgresProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParsePostgresProperty) | Struct | Use this processor to parse RDS for PostgreSQL vended logs, extract fields, and and convert them into a JSON format. |
| [`CfnTransformer.ParseRoute53Property`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseRoute53Property) | Struct | Use this processor to parse Route 53 vended logs, extract fields, and and convert them into a JSON format. |
| [`CfnTransformer.ParseToOCSFProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseToOCSFProperty) | Struct | This processor converts logs into [Open Cybersecurity Schema Framework (OCSF)](https://docs.aws.amazon.com/https://ocsf.io) events. |
| [`CfnTransformer.ParseVPCProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseVPCProperty) | Struct | Use this processor to parse Amazon VPC vended logs, extract fields, and and convert them into a JSON format. |
| [`CfnTransformer.ParseWAFProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ParseWAFProperty) | Struct | Use this processor to parse AWS WAF vended logs, extract fields, and and convert them into a JSON format. |
| [`CfnTransformer.ProcessorProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.ProcessorProperty) | Struct | This structure contains the information about one processor in a log transformer. |
| [`CfnTransformer.RenameKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.RenameKeyEntryProperty) | Struct | This object defines one key that will be renamed with the [renameKey](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-renameKey) processor. |
| [`CfnTransformer.RenameKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.RenameKeysProperty) | Struct | Use this processor to rename keys in a log event. |
| [`CfnTransformer.SplitStringEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.SplitStringEntryProperty) | Struct | This object defines one log field that will be split with the [splitString](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-splitString) processor. |
| [`CfnTransformer.SplitStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.SplitStringProperty) | Struct | Use this processor to split a field into an array of strings using a delimiting character. |
| [`CfnTransformer.SubstituteStringEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.SubstituteStringEntryProperty) | Struct | This object defines one log field key that will be replaced using the [substituteString](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-substituteString) processor. |
| [`CfnTransformer.SubstituteStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.SubstituteStringProperty) | Struct | This processor matches a key’s value against a regular expression and replaces all matches with a replacement string. |
| [`CfnTransformer.TrimStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.TrimStringProperty) | Struct | Use this processor to remove leading and trailing whitespace. |
| [`CfnTransformer.TypeConverterEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.TypeConverterEntryProperty) | Struct | This object defines one value type that will be converted using the [typeConverter](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch-Logs-Transformation-Processors.html#CloudWatch-Logs-Transformation-typeConverter) processor. |
| [`CfnTransformer.TypeConverterProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.TypeConverterProperty) | Struct | Use this processor to convert a value type associated with the specified key to the specified type. |
| [`CfnTransformer.UpperCaseStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformer.UpperCaseStringProperty) | Struct | This processor converts a string field to uppercase. |
| [`CfnTransformerProps`](/v2/docs/aws-cdk-lib.aws_logs.CfnTransformerProps) | Struct | Properties for defining a `CfnTransformer`. |
| [`ColumnRestriction`](/v2/docs/aws-cdk-lib.aws_logs.ColumnRestriction) | Struct |  |
| [`CopyValueEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.CopyValueEntryProperty) | Struct | This object defines one value to be copied with the copyValue processor. |
| [`CopyValueProperty`](/v2/docs/aws-cdk-lib.aws_logs.CopyValueProperty) | Struct | Copy Value processor, copies values from source to target for each entry. |
| [`CrossAccountDestinationProps`](/v2/docs/aws-cdk-lib.aws_logs.CrossAccountDestinationProps) | Struct | Properties for a CrossAccountDestination. |
| [`CsvProperty`](/v2/docs/aws-cdk-lib.aws_logs.CsvProperty) | Struct | The CSV processor parses comma-separated values (CSV) from the log events into columns. |
| [`CustomDataIdentifier`](/v2/docs/aws-cdk-lib.aws_logs.CustomDataIdentifier) | Class | A custom data identifier. |
| [`DataConverterProcessor`](/v2/docs/aws-cdk-lib.aws_logs.DataConverterProcessor) | Class | Processor for data conversion operations. |
| [`DataConverterProps`](/v2/docs/aws-cdk-lib.aws_logs.DataConverterProps) | Struct | Properties for creating data converter processors. |
| [`DataConverterType`](/v2/docs/aws-cdk-lib.aws_logs.DataConverterType) | Enum | Types of data conversion operations. |
| [`DataIdentifier`](/v2/docs/aws-cdk-lib.aws_logs.DataIdentifier) | Class | A data protection identifier. |
| [`DataProtectionPolicy`](/v2/docs/aws-cdk-lib.aws_logs.DataProtectionPolicy) | Class | Creates a data protection policy for CloudWatch Logs log groups. |
| [`DataProtectionPolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.DataProtectionPolicyProps) | Struct | Properties for creating a data protection policy. |
| [`DateTimeConverterProperty`](/v2/docs/aws-cdk-lib.aws_logs.DateTimeConverterProperty) | Struct | This processor converts a datetime string into a format that you specify. |
| [`DateTimeFormat`](/v2/docs/aws-cdk-lib.aws_logs.DateTimeFormat) | Enum | Standard datetime formats for the DateTimeConverter processor. |
| [`DelimiterCharacter`](/v2/docs/aws-cdk-lib.aws_logs.DelimiterCharacter) | Enum | Valid delimiter characters for CSV processor. |
| [`Distribution`](/v2/docs/aws-cdk-lib.aws_logs.Distribution) | Enum | The method used to distribute log data to the destination. |
| [`FieldIndexPolicy`](/v2/docs/aws-cdk-lib.aws_logs.FieldIndexPolicy) | Class | Creates a field index policy for CloudWatch Logs log groups. |
| [`FieldIndexPolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.FieldIndexPolicyProps) | Struct | Properties for creating field index policies. |
| [`FilterPattern`](/v2/docs/aws-cdk-lib.aws_logs.FilterPattern) | Class | A collection of static methods to generate appropriate ILogPatterns. |
| [`GrokProperty`](/v2/docs/aws-cdk-lib.aws_logs.GrokProperty) | Struct | This processor uses pattern matching to parse and structure unstructured data. |
| [`IFilterPattern`](/v2/docs/aws-cdk-lib.aws_logs.IFilterPattern) | Interface | Interface for objects that can render themselves to log patterns. |
| [`ILogGroup`](/v2/docs/aws-cdk-lib.aws_logs.ILogGroup) | Interface |  |
| [`ILogStream`](/v2/docs/aws-cdk-lib.aws_logs.ILogStream) | Interface |  |
| [`ILogSubscriptionDestination`](/v2/docs/aws-cdk-lib.aws_logs.ILogSubscriptionDestination) | Interface | Interface for classes that can be the destination of a log Subscription. |
| [`IProcessor`](/v2/docs/aws-cdk-lib.aws_logs.IProcessor) | Interface | Interface representing a single processor in a CloudWatch Logs transformer. |
| [`JsonMutatorProcessor`](/v2/docs/aws-cdk-lib.aws_logs.JsonMutatorProcessor) | Class | Processor for JSON mutation operations. |
| [`JsonMutatorProps`](/v2/docs/aws-cdk-lib.aws_logs.JsonMutatorProps) | Struct | Properties for creating JSON mutator processors. |
| [`JsonMutatorType`](/v2/docs/aws-cdk-lib.aws_logs.JsonMutatorType) | Enum | Types of JSON mutation operations. |
| [`JsonPattern`](/v2/docs/aws-cdk-lib.aws_logs.JsonPattern) | Class | Base class for patterns that only match JSON log events. |
| [`KeyValueDelimiter`](/v2/docs/aws-cdk-lib.aws_logs.KeyValueDelimiter) | Enum | Valid key-value delimiters for ParseKeyValue processor. |
| [`KeyValuePairDelimiter`](/v2/docs/aws-cdk-lib.aws_logs.KeyValuePairDelimiter) | Enum | Valid field delimiters for ParseKeyValue processor. |
| [`ListToMapProperty`](/v2/docs/aws-cdk-lib.aws_logs.ListToMapProperty) | Struct | This processor takes a list of objects that contain key fields, and converts them into a map of target keys. |
| [`LogGroupClass`](/v2/docs/aws-cdk-lib.aws_logs.LogGroupClass) | Enum | Class of Log Group. |
| [`LogGroupGrants`](/v2/docs/aws-cdk-lib.aws_logs.LogGroupGrants) | Facade | Collection of grant methods for a ILogGroupRef. |
| [`LogGroupProps`](/v2/docs/aws-cdk-lib.aws_logs.LogGroupProps) | Struct | Properties for a LogGroup. |
| [`LogRetention`](/v2/docs/aws-cdk-lib.aws_logs.LogRetention) | Construct | Creates a custom resource to control the retention policy of a CloudWatch Logs log group. |
| [`LogRetentionProps`](/v2/docs/aws-cdk-lib.aws_logs.LogRetentionProps) | Struct | Construction properties for a LogRetention. |
| [`LogRetentionRetryOptions`](/v2/docs/aws-cdk-lib.aws_logs.LogRetentionRetryOptions) | Struct | Retry options for all AWS API calls. |
| [`LogStreamAttributes`](/v2/docs/aws-cdk-lib.aws_logs.LogStreamAttributes) | Struct | Attributes for importing a LogStream. |
| [`LogStreamProps`](/v2/docs/aws-cdk-lib.aws_logs.LogStreamProps) | Struct | Properties for a LogStream. |
| [`LogSubscriptionDestinationConfig`](/v2/docs/aws-cdk-lib.aws_logs.LogSubscriptionDestinationConfig) | Struct | Properties returned by a Subscription destination. |
| [`MetricFilterOptions`](/v2/docs/aws-cdk-lib.aws_logs.MetricFilterOptions) | Struct | Properties for a MetricFilter created from a LogGroup. |
| [`MetricFilterProps`](/v2/docs/aws-cdk-lib.aws_logs.MetricFilterProps) | Struct | Properties for a MetricFilter. |
| [`MoveKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.MoveKeyEntryProperty) | Struct | This object defines one key that will be moved with the moveKey processor. |
| [`MoveKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.MoveKeysProperty) | Struct | This processor moves a key from one field to another. |
| [`OCSFSourceType`](/v2/docs/aws-cdk-lib.aws_logs.OCSFSourceType) | Enum | Types of event sources supported to convert to OCSF format. |
| [`OCSFVersion`](/v2/docs/aws-cdk-lib.aws_logs.OCSFVersion) | Enum | OCSF Schema versions supported by transformers. |
| [`ParseJSONProperty`](/v2/docs/aws-cdk-lib.aws_logs.ParseJSONProperty) | Struct | This processor parses log events that are in JSON format. |
| [`ParseKeyValueProperty`](/v2/docs/aws-cdk-lib.aws_logs.ParseKeyValueProperty) | Struct | This processor parses a specified field in the original log event into key-value pairs. |
| [`ParserProcessor`](/v2/docs/aws-cdk-lib.aws_logs.ParserProcessor) | Class | Parser processor for common data formats. |
| [`ParserProcessorProps`](/v2/docs/aws-cdk-lib.aws_logs.ParserProcessorProps) | Struct | Properties for creating configurable parser processors. |
| [`ParserProcessorType`](/v2/docs/aws-cdk-lib.aws_logs.ParserProcessorType) | Enum | Types of configurable parser processors. |
| [`ParseToOCSFProperty`](/v2/docs/aws-cdk-lib.aws_logs.ParseToOCSFProperty) | Struct | Processor to parse events from CloudTrail, Route53Resolver, VPCFlow, EKSAudit and AWSWAF into OCSF V1.1 format. |
| [`ProcessorDeleteKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.ProcessorDeleteKeysProperty) | Struct | This processor adds new key-value pairs to the log event. |
| [`QueryDefinitionProps`](/v2/docs/aws-cdk-lib.aws_logs.QueryDefinitionProps) | Struct | Properties for a QueryDefinition. |
| [`QueryString`](/v2/docs/aws-cdk-lib.aws_logs.QueryString) | Class | Define a QueryString. |
| [`QueryStringProps`](/v2/docs/aws-cdk-lib.aws_logs.QueryStringProps) | Struct | Properties for a QueryString. |
| [`QuoteCharacter`](/v2/docs/aws-cdk-lib.aws_logs.QuoteCharacter) | Enum | Valid quote characters for CSV processor. |
| [`RenameKeyEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.RenameKeyEntryProperty) | Struct | This object defines one key that will be renamed with the renameKey processor. |
| [`RenameKeysProperty`](/v2/docs/aws-cdk-lib.aws_logs.RenameKeysProperty) | Struct | Use this processor to rename keys in a log event. |
| [`ResourcePolicyProps`](/v2/docs/aws-cdk-lib.aws_logs.ResourcePolicyProps) | Struct | Properties to define Cloudwatch log group resource policy. |
| [`RetentionDays`](/v2/docs/aws-cdk-lib.aws_logs.RetentionDays) | Enum | How long, in days, the log contents will be retained. |
| [`SpaceDelimitedTextPattern`](/v2/docs/aws-cdk-lib.aws_logs.SpaceDelimitedTextPattern) | Class | Space delimited text pattern. |
| [`SplitStringEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.SplitStringEntryProperty) | Struct | This object defines one log field that will be split with the splitString processor. |
| [`SplitStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.SplitStringProperty) | Struct | Use this processor to split a field into an array of strings using a delimiting character. |
| [`StreamOptions`](/v2/docs/aws-cdk-lib.aws_logs.StreamOptions) | Struct | Properties for a new LogStream created from a LogGroup. |
| [`StringMutatorProcessor`](/v2/docs/aws-cdk-lib.aws_logs.StringMutatorProcessor) | Class | Processor for string mutation operations. |
| [`StringMutatorProps`](/v2/docs/aws-cdk-lib.aws_logs.StringMutatorProps) | Struct | Properties for creating string mutator processors. |
| [`StringMutatorType`](/v2/docs/aws-cdk-lib.aws_logs.StringMutatorType) | Enum | Types of string mutation operations. |
| [`SubscriptionFilterOptions`](/v2/docs/aws-cdk-lib.aws_logs.SubscriptionFilterOptions) | Struct | Properties for a new SubscriptionFilter created from a LogGroup. |
| [`SubscriptionFilterProps`](/v2/docs/aws-cdk-lib.aws_logs.SubscriptionFilterProps) | Struct | Properties for a SubscriptionFilter. |
| [`SubstituteStringEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.SubstituteStringEntryProperty) | Struct | This object defines one log field key that will be replaced using the substituteString processor. |
| [`SubstituteStringProperty`](/v2/docs/aws-cdk-lib.aws_logs.SubstituteStringProperty) | Struct | This processor matches a key's value against a regular expression and replaces all matches with a replacement string. |
| [`TransformerOptions`](/v2/docs/aws-cdk-lib.aws_logs.TransformerOptions) | Struct | Properties for Transformer created from LogGroup. |
| [`TransformerProps`](/v2/docs/aws-cdk-lib.aws_logs.TransformerProps) | Struct | The Resource properties for AWS::Logs::Transformer resource. |
| [`TypeConverterEntryProperty`](/v2/docs/aws-cdk-lib.aws_logs.TypeConverterEntryProperty) | Struct | This object defines one value type that will be converted using the typeConverter processor. |
| [`TypeConverterProperty`](/v2/docs/aws-cdk-lib.aws_logs.TypeConverterProperty) | Struct | Use this processor to convert a value type associated with the specified key to the specified type. |
| [`TypeConverterType`](/v2/docs/aws-cdk-lib.aws_logs.TypeConverterType) | Enum | Valid data types for type conversion in the TypeConverter processor. |
| [`VendedLogParser`](/v2/docs/aws-cdk-lib.aws_logs.VendedLogParser) | Class | Parser processor for AWS vended logs. |
| [`VendedLogParserProps`](/v2/docs/aws-cdk-lib.aws_logs.VendedLogParserProps) | Struct | Properties for creating AWS vended log parsers. |
| [`VendedLogType`](/v2/docs/aws-cdk-lib.aws_logs.VendedLogType) | Enum | Types of AWS vended logs with built-in parsers. |
