interface ILogGroup
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Logs.ILogGroup |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awslogs#ILogGroup |
![]() | software.amazon.awscdk.services.logs.ILogGroup |
![]() | aws_cdk.aws_logs.ILogGroup |
![]() | 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. |
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 by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that 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.
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. |
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
Policy
Statement
Returns
Add a statement to the resource's resource policy.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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.