# ILogGroup

Extends: [IResourceWithPolicy](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IResourceWithPolicy.html), [ILogGroupRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.ILogGroupRef.html)
Implemented by: [LogGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)
Obtainable from: [LogGroup.fromLogGroupArn](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html#fromloggrouparn), [LogGroup.fromLogGroupName](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html#fromloggroupname)
Used as argument in: [CloudWatchLogsAction (initializer)](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-iot-actions-alpha.CloudWatchLogsAction.html#initializer), CloudWatchLogsTarget (initializer), CloudwatchLogsLogDestination (initializer), EnableLogging (initializer), LoggingDestination.cloudWatchLogs (@aws-cdk/aws-bedrock-agentcore-alpha), LoggingDestination.cloudWatchLogs (aws_bedrockagentcore)

- Source: [`aws-logs/lib/log-group.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-logs/lib/log-group.ts#L26)
- Type last changed: v2.227.0 · 21 Nov 2025

## Properties

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `logGroupArn`: string — The ARN of this log group, with ':*' appended.

- `logGroupName`: string — The name of this log group.

- `logGroupRef`: [LogGroupReference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_logs.LogGroupReference.html) — A reference to a LogGroup resource.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter` — Create a new Metric Filter on this Log Group.

  **Parameters**

  - `id` — Unique identifier for the construct in its parent.
  - `props` — Properties for creating the MetricFilter.

- `addStream(id: string, props?: StreamOptions): LogStream` — Create a new Log Stream for this Log Group.

  **Parameters**

  - `id` — Unique identifier for the construct in its parent.
  - `props` — Properties for creating the LogStream.

- `addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter` — Create a new Subscription Filter on this Log Group.

  **Parameters**

  - `id` — Unique identifier for the construct in its parent.
  - `props` — Properties for creating the SubscriptionFilter.

- `addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult` — Add a statement to the resource's resource policy.

- `addTransformer(id: string, props: TransformerOptions): Transformer` — Create a new Transformer on this Log Group.

  **Parameters**

  - `id` — Unique identifier for the construct in its parent.
  - `props` — Properties for creating the Transformer.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `extractMetric(jsonField: string, metricNamespace: string, metricName: string): 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` — JSON field to extract (example: '$.myfield').
  - `metricNamespace` — Namespace to emit the metric under.
  - `metricName` — Name to emit the metric under.

  **Returns:** A Metric object representing the extracted metric

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Give the indicated permissions on this log group and all streams.

- `grantRead(grantee: IGrantable): Grant` — Give permissions to read from this log group and streams.

- `grantWrite(grantee: IGrantable): Grant` — Give permissions to write to create and write to streams in this log group.

- `logGroupPhysicalName(): string` — Public method to get the physical name of this log group.

- `metric(metricName: string, props?: MetricOptions): Metric` — Return the given named metric for this Log Group.

  **Parameters**

  - `metricName` — The name of the metric.
  - `props` — Properties for the metric.

- `metricIncomingBytes(props?: MetricOptions): Metric` — The volume of log events in uncompressed bytes uploaded to CloudWatch Logs.

  When used with the LogGroupName dimension, this is the volume of log events
  in uncompressed bytes uploaded to the log group.

  **Parameters**

  - `props` — Properties for the Cloudwatch metric.

- `metricIncomingLogEvents(props?: MetricOptions): Metric` — The number of log events uploaded to CloudWatch Logs.

  When used with the LogGroupName dimension, this is the number of
  log events uploaded to the log group.

  **Parameters**

  - `props` — Properties for the Cloudwatch metric.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
