-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk-lib/aws-rds/DatabaseInstance: Get log group of cloudwatchLogsExports #20358
Comments
Currently you could access these log groups through escape hatches, by selecting the proper child from the We create the log groups here aws-cdk/packages/@aws-cdk/aws-rds/lib/instance.ts Lines 765 to 775 in 83f1668
I don't see why we couldn't expose these directly from the DatabaseInstance. Leaving this up as a good first issue for anyone to submit a PR for 🙂 |
I noticed that the previous PR was closed due to inactivity. Going to give it another attempt to address this issue. |
…8676) There isn't an easy way to get the new created log group of an DatabaseInstance if the DatabaseInstance has the cloudwatchLogsExport property set. Right now users would have to manual figure out the log group name by constructing `/aws/rds/instance/${this.databaseInstance.instanceIdentifier}/postgresql`. Same applies to RDS cluster resource. This is also dangerous as it relies on the naming convention unmodified. It would break the application if the naming convention was somehow changed. Add a new property `cloudwatchLogGroups` to RDS instance and cluster. Closes #<#20358>. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This is now supported (pending release), detail usage can be found in README |
|
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
CDK version used
2.23.0
Environment details (OS name and version, etc.)
Windows 10, Typescript
The text was updated successfully, but these errors were encountered: