# LoggingConfig

A logging configuration for delivery status of messages sent from SNS topic to subscribed endpoints.

- Source: [`aws-sns/lib/topic.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-sns/lib/topic.ts#L145)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

```ts
declare const role: iam.Role;
const topic = new sns.Topic(this, 'MyTopic');

topic.addLoggingConfig({
  protocol: sns.LoggingProtocol.SQS,
  failureFeedbackRole: role,
  successFeedbackRole: role,
  successFeedbackSampleRate: 50,
});
```

## Properties

- `failureFeedbackRole`: [IRoleRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_iam.IRoleRef.html) = None — The IAM role to be used when logging failed message deliveries in Amazon CloudWatch.

- `protocol`: [LoggingProtocol](/cdk/api/v2/docs/aws-cdk-lib.aws_sns.LoggingProtocol.html) (required) — Indicates one of the supported protocols for the SNS topic.

- `successFeedbackRole`: [IRoleRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_iam.IRoleRef.html) = None — The IAM role to be used when logging successful message deliveries in Amazon CloudWatch.

- `successFeedbackSampleRate`: number = None — The percentage of successful message deliveries to be logged in Amazon CloudWatch.

  Valid values are integer between 0-100
