Skip to content

aws-cdk-lib/aws-rds/DatabaseInstance: Get log group of cloudwatchLogsExports #20358

@Korbi10

Description

@Korbi10

Describe the feature

As software developer I would like to get the new created log group of an DatabaseInstance if the DatabaseInstance has the cloudwatchLogsExport property set, so that I can build metric filter based on that log group and I do not have to calculate the naming behavior like AWS does

Use Case

Currently in our database stack we get the log group of the DatabaseInstance by calculating the name by ourself which looks for the Metric filter Like this:

new MetricFilter(this, 'SomeID', {
logGroup: LogGroup.fromLogGroupName(this, 'SomeID', /aws/rds/instance/${this.databaseInstance.instanceIdentifier}/postgresql),
filterPattern: FilterPattern.anyTerm('ERROR', 'Caused by', 'error'),
metricName: logMetrics.metricName,
metricNamespace: logMetrics.namespace,
defaultValue: 0,
metricValue: '1',
});

this indicates, that we always knew the DatabaseInstance identifier and the used engine. Also we rely here on the naming convention of AWS. This seems dangerous to me.

Proposed Solution

The DatabaseInstance has a method or Property which contains the log group name or ARN so that we can get it in other services.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.23.0

Environment details (OS name and version, etc.)

Windows 10, Typescript

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-rdsRelated to Amazon Relational Databaseeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions