Describe the bug
I have created a Neptune cluster with the DatabaseCluster construct via aws-neptune-alpha. I enabled audit and slowquery logging, and I would like to export these logs to CloudWatch. However, I am unable to set a custom retention period for both sets of logs due to a bug related to string interpolation. The build will fail with the error message "Error: There is already a Construct with name [object Object]LogRetention in DatabaseCluster ...". Since the interpolated LogType object always resolves to [object Object], CDK throws errors stating that such a construct already exists when more than one log type is exported.
Expected Behavior
Users should be able to export more than one log type to CloudWatch and set a custom retention period using cloudwatchLogsExports and cloudwatchLogsRetention like so:
this.databaseCluster = new DatabaseCluster(
this,
`${name}`,
{
...
...
cloudwatchLogsExports: [new LogType('audit'), new LogType('slowquery')],
cloudwatchLogsRetention: RetentionDays.ONE_MONTH,
}
)
Current Behavior
When a custom retention period is set for more than one log type exported to CloudWatch, the error There is already a Construct with name '[object Object]LogRetention' in DatabaseCluster {databaseCluster name} is thrown.
Reproduction Steps
Instantiate a new Neptune DatabaseCluster instance using aws-neptune-alpha, and enable audit logging and slow query logging. Then enable exporting these logs to CloudWatch with a custom retention period like so:
this.databaseCluster = new DatabaseCluster(
this,
`${name}`,
{
...
...
cloudwatchLogsExports: [new LogType('audit'), new LogType('slowquery')],
cloudwatchLogsRetention: RetentionDays.ONE_MONTH,
}
)
Possible Solution
Interpolating the string value of the object instead of the object itself should fix the issue (ie ${logType.value}LogRetention instead of ${logType}LogRetention).
Additional Information/Context
No response
CDK CLI Version
2.87.0
Framework Version
No response
Node.js Version
v19.7.0
OS
macOS/Linux
Language
Typescript
Language Version
3.9.4
Other information
No response
Describe the bug
I have created a Neptune cluster with the
DatabaseClusterconstruct viaaws-neptune-alpha. I enabled audit and slowquery logging, and I would like to export these logs to CloudWatch. However, I am unable to set a custom retention period for both sets of logs due to a bug related to string interpolation. The build will fail with the error message "Error: There is already a Construct with name[object Object]LogRetentionin DatabaseCluster ...". Since the interpolated LogType object always resolves to[object Object], CDK throws errors stating that such a construct already exists when more than one log type is exported.Expected Behavior
Users should be able to export more than one log type to CloudWatch and set a custom retention period using
cloudwatchLogsExportsandcloudwatchLogsRetentionlike so:Current Behavior
When a custom retention period is set for more than one log type exported to CloudWatch, the error
There is already a Construct with name '[object Object]LogRetention' in DatabaseCluster {databaseCluster name}is thrown.Reproduction Steps
Instantiate a new Neptune DatabaseCluster instance using aws-neptune-alpha, and enable audit logging and slow query logging. Then enable exporting these logs to CloudWatch with a custom retention period like so:
Possible Solution
Interpolating the string value of the object instead of the object itself should fix the issue (ie
${logType.value}LogRetentioninstead of${logType}LogRetention).Additional Information/Context
No response
CDK CLI Version
2.87.0
Framework Version
No response
Node.js Version
v19.7.0
OS
macOS/Linux
Language
Typescript
Language Version
3.9.4
Other information
No response