Skip to content
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

fix(neptune-alpha): multiple cloudwatchLogsExports cannot be set when configuring log retention #28643

Merged
merged 27 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
da91441
fix: logName
badmintoncryer Jan 10, 2024
a6ba118
fix: remove irrevant update
badmintoncryer Jan 10, 2024
a3eaf7f
test: integ test
badmintoncryer Jan 10, 2024
811d19a
feat: add feature flag
badmintoncryer Jan 18, 2024
a7daf85
feat: feature flag
badmintoncryer Jan 18, 2024
78e3a6f
fix: integ test
badmintoncryer Jan 18, 2024
015a758
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 18, 2024
b1218a8
fix: integ test
badmintoncryer Jan 19, 2024
59f0466
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 19, 2024
bfc21d6
Revert "Merge branch 'main' into 26295-logExport"
badmintoncryer Jan 19, 2024
a1e707e
Revert "fix: integ test"
badmintoncryer Jan 19, 2024
9b595cd
Revert "Merge branch 'main' into 26295-logExport"
badmintoncryer Jan 19, 2024
b76c283
Revert "fix: integ test"
badmintoncryer Jan 19, 2024
a06e9aa
Revert "feat: feature flag"
badmintoncryer Jan 19, 2024
b9d99ca
Revert "feat: add feature flag"
badmintoncryer Jan 19, 2024
12249ec
Revert "test: integ test"
badmintoncryer Jan 19, 2024
61402fc
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 19, 2024
3ceba53
fix
badmintoncryer Jan 19, 2024
f66f974
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 23, 2024
82b453b
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 23, 2024
0b0c0b7
Merge branch 'main' into 26295-logExport
paulhcsun Jan 25, 2024
68f4c5c
Merge branch 'main' into 26295-logExport
badmintoncryer Jan 26, 2024
9a3cbb0
Merge branch 'main' into 26295-logExport
paulhcsun Jan 26, 2024
cd32bd5
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
cef5ad3
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
9844c1d
Merge branch 'main' into 26295-logExport
paulhcsun Jan 29, 2024
3703619
Merge branch 'main' into 26295-logExport
paulhcsun Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-neptune-alpha/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ export class DatabaseCluster extends DatabaseClusterBase implements IDatabaseClu
const retention = props.cloudwatchLogsRetention;
if (retention) {
props.cloudwatchLogsExports?.forEach(logType => {
new logs.LogRetention(this, `${logType}LogRetention`, {
new logs.LogRetention(this, `${logType.value}LogRetention`, {
logGroupName: `/aws/neptune/${this.clusterIdentifier}/${logType.value}`,
role: props.cloudwatchLogsRetentionRole,
retention,
Expand Down
49 changes: 49 additions & 0 deletions packages/@aws-cdk/aws-neptune-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,55 @@ describe('DatabaseCluster', () => {
});
}).toThrow(/ServerlessScalingConfiguration minCapacity 10 must be less than serverlessScalingConfiguration maxCapacity 5/);
});

test('cloudwatchLogsExports log retention is enabled when configured for multiple logs exports', () => {
// GIVEN
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
new DatabaseCluster(stack, 'Cluster', {
vpc,
instanceType: InstanceType.R5_LARGE,
cloudwatchLogsExports: [LogType.AUDIT, new LogType('slowquery')],
cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Neptune::DBCluster', {
EnableCloudwatchLogsExports: ['audit', 'slowquery'],
});
Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', {
LogGroupName: {
'Fn::Join': [
'',
[
'/aws/neptune/',
{
Ref: 'ClusterEB0386A7',
},
'/audit',
],
],
},
RetentionInDays: 30,
});
Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', {
LogGroupName: {
'Fn::Join': [
'',
[
'/aws/neptune/',
{
Ref: 'ClusterEB0386A7',
},
'/slowquery',
],
],
},
RetentionInDays: 30,
});
});
});

function testStack() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
"Type": "AWS::Neptune::DBClusterParameterGroup",
"Properties": {
"Description": "A nice parameter group",
"Family": "neptune1",
"Family": "neptune1.2",
"Parameters": {
"neptune_enable_audit_log": "1",
"neptune_query_timeout": "100000"
Expand Down Expand Up @@ -505,6 +505,7 @@
"EnableCloudwatchLogsExports": [
"audit"
],
"EngineVersion": "1.2.1.0",
"KmsKeyId": {
"Fn::GetAtt": [
"DbSecurity381C2C15",
Expand All @@ -524,7 +525,7 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"DatabaseobjectObjectLogRetentionA247AF0C": {
"DatabaseauditLogRetention8A29F5CC": {
"Type": "Custom::LogRetention",
"Properties": {
"ServiceToken": {
Expand Down Expand Up @@ -631,7 +632,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "a8515c042d9c942705087943220417be929ac44f968d8fcef2681681b400c0c0.zip"
"S3Key": "e4afb15788ec44ed9ff3377e1d131ba2768d7b2e2931bc000d1f2005879b3035.zip"
},
"Role": {
"Fn::GetAtt": [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading