diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts b/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts index ecb4d9f0dd9c1..b536db6003ec3 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts +++ b/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts @@ -145,6 +145,7 @@ export class SplunkLogDriver extends LogDriver { 'splunk-verify-connection': this.props.verifyConnection, 'splunk-gzip': this.props.gzip, 'splunk-gzip-level': this.props.gzipLevel, + 'splunk-tag': this.props.tag, ...renderCommonLogDriverOptions(this.props), }), }; diff --git a/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts b/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts index c8afd01daade1..fb1091a3ae027 100644 --- a/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts +++ b/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts @@ -103,4 +103,35 @@ nodeunitShim({ test.done(); }, + + 'create a splunk log driver using splunk-tag property when tag is defined'(test: Test) { + // WHEN + td.addContainer('Container', { + image, + logging: ecs.LogDrivers.splunk({ + token: cdk.SecretValue.secretsManager('my-splunk-token'), + url: 'my-splunk-url', + tag: 'abc', + }), + memoryLimitMiB: 128, + }); + + // THEN + expect(stack).to(haveResourceLike('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + LogConfiguration: { + LogDriver: 'splunk', + Options: { + 'splunk-token': '{{resolve:secretsmanager:my-splunk-token:SecretString:::}}', + 'splunk-url': 'my-splunk-url', + 'splunk-tag': 'abc', + }, + }, + }, + ], + })); + + test.done(); + }, });