interface ILogGroup
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Logs.ILogGroup |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#ILogGroup |
Java | software.amazon.awscdk.services.logs.ILogGroup |
Python | aws_cdk.aws_logs.ILogGroup |
TypeScript (source) | aws-cdk-lib ยป aws_logs ยป ILogGroup |
Implemented by
Log
Obtainable from
Log.fromLogGroupArn(), Log.fromLogGroupName()
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| log | string | The ARN of this log group, with ':*' appended. |
| log | string | The name of this log group. |
| log | Log | A reference to a LogGroup resource. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
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
Type:
string
The ARN of this log group, with ':*' appended.
logGroupName
Type:
string
The name of this log group.
logGroupRef
Type:
Log
A reference to a LogGroup resource.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
| Name | Description |
|---|---|
| add | Create a new Metric Filter on this Log Group. |
| add | Create a new Log Stream for this Log Group. |
| add | Create a new Subscription Filter on this Log Group. |
| add | Add a statement to the resource's resource policy. |
| add | Create a new Transformer on this Log Group. |
| apply | Apply the given removal policy to this resource. |
| extract | Extract a metric from structured log events in the LogGroup. |
| grant(grantee, ...actions) | Give the indicated permissions on this log group and all streams. |
| grant | Give permissions to read from this log group and streams. |
| grant | Give permissions to write to create and write to streams in this log group. |
| log | Public method to get the physical name of this log group. |
| metric(metricName, props?) | Return the given named metric for this Log Group. |
| metric | The volume of log events in uncompressed bytes uploaded to CloudWatch Logs. |
| metric | The number of log events uploaded to CloudWatch Logs. |
addMetricFilter(id, props)
public addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter
Parameters
- id
stringโ Unique identifier for the construct in its parent. - props
Metricโ Properties for creating the MetricFilter.Filter Options
Returns
Create a new Metric Filter on this Log Group.
addStream(id, props?)
public addStream(id: string, props?: StreamOptions): LogStream
Parameters
- id
stringโ Unique identifier for the construct in its parent. - props
Streamโ Properties for creating the LogStream.Options
Returns
Create a new Log Stream for this Log Group.
addSubscriptionFilter(id, props)
public addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter
Parameters
- id
stringโ Unique identifier for the construct in its parent. - props
Subscriptionโ Properties for creating the SubscriptionFilter.Filter Options
Returns
Create a new Subscription Filter on this Log Group.
addToResourcePolicy(statement)
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
Parameters
- statement
PolicyStatement
Returns
Add a statement to the resource's resource policy.
addTransformer(id, props)
public addTransformer(id: string, props: TransformerOptions): Transformer
Parameters
- id
stringโ Unique identifier for the construct in its parent. - props
Transformerโ Properties for creating the Transformer.Options
Returns
Create a new Transformer on this Log Group.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
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, metricNamespace, metricName)
public extractMetric(jsonField: string, metricNamespace: string, metricName: string): Metric
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
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.
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantable - actions
string
Returns
Give the indicated permissions on this log group and all streams.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Give permissions to read from this log group and streams.
grantWrite(grantee)
public grantWrite(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Give permissions to write to create and write to streams in this log group.
logGroupPhysicalName()
public logGroupPhysicalName(): string
Returns
string
Public method to get the physical name of this log group.
metric(metricName, props?)
public metric(metricName: string, props?: MetricOptions): Metric
Parameters
- metricName
stringโ The name of the metric. - props
Metricโ Properties for the metric.Options
Returns
Return the given named metric for this Log Group.
metricIncomingBytes(props?)
public metricIncomingBytes(props?: MetricOptions): Metric
Parameters
- props
Metricโ Properties for the Cloudwatch metric.Options
Returns
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.
metricIncomingLogEvents(props?)
public metricIncomingLogEvents(props?: MetricOptions): Metric
Parameters
- props
Metricโ Properties for the Cloudwatch metric.Options
Returns
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.

.NET
Go
Java
Python
TypeScript (