aws / aws/aws-cdk

(aws-events): add enhanced logging support to `EventBus`

Open
#35,000 8 comments 6 reactions 0 assignees View on GitHub
@aws-cdk/aws-events effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

AWS CDK should support the new [EventBridge Event Buses logging](https://aws.amazon.com/about-aws/whats-new/2025/07/amazon-eventbridge-enhanced-logging-improved-observability/) capability. This is similar to the [EventBridge Pipes logging](https://aws.amazon.com/about-aws/whats-new/2023/11/amazon-eventbridge-logging-improved-observability//) capability added a couple of years ago.

### Use Case

With the new EventBridge enhanced logging capability, developers can now monitor and debug event-driven applications with comprehensive logs that provide visibility into the complete event journey. This addresses microservices and event-driven architecture monitoring challenges by providing detailed event lifecycle tracking.

### Proposed Solution

Add logging configuration support to the `EventBus` construct in the `aws-events` module, following the proven design patterns from the EventBridge Pipes alpha module (`@aws-cdk/aws-pipes-alpha`) to ensure consistency across EventBridge services.

### Proposed API Design

```typescript
import * as events from 'aws-cdk-lib/aws-events';
import * as logs from 'aws-cdk-lib/aws-logs';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';

// Create an event bus with logging configuration
const logGroup = new logs.LogGroup(this, 'EventBridgeLogGroup');

const eventBus = new events.EventBus(this, 'MyEventBus', {
eventBusName: 'my-custom-bus',
logDestinations: [
new events.CloudwatchLogsLogDestination(logGroup)
],
logLevel: events.LogLevel.INFO,
logIncludeExecutionData: [events.IncludeExecutionData.ALL]
});

// Configure multiple log destinations
const s3Bucket = new s3.Bucket(this, 'LogBucket');
const deliveryStream = new firehose.DeliveryStream(this, 'LogStream', {
destination: new firehose.S3Bucket(s3Bucket)
});

eventBus.configureLogging({
logDestinations: [
new events.CloudwatchLogsLogDestination(logGroup),
new events.S3LogDestination({
bucket: s3Bucket,
prefix: 'eventbridge-logs/',
outputFormat: events.S3OutputFormat.JSON
}),
new events.FirehoseLogDestination(deliveryStream)
],
logLevel: events.LogLevel.ERROR,
logIncludeExecutionData: [events.IncludeExecutionData.ALL]
});
```

### Supported Features

**Log Destinations:**
- CloudWatch Logs
- Amazon S3
- Kinesis Data Firehose

**Log Levels:**
- `OFF`
- `ERROR`
- `INFO`
- `TRACE`

**Configuration Options:**
- Include execution data (event payloads) with privacy control
- Multiple destination support
- Encryption support (customer-managed keys)

### Implementation Details

Generate CloudFormation properties mapping to EventBridge logging API parameters: `LoggingConfiguration.LogDestination`, `LoggingConfiguration.LogLevel`, and `LoggingConfiguration.IncludeExecutionData`.

**Key patterns to adopt:**

1. `ILogDestination` interface with `bind()` and `grantPush()` methods
2. Separate destination classes (`CloudwatchLogsLogDestination`, `FirehoseLogDestination`, `S3LogDestination`)
3. Configuration enums (`LogLevel`, `IncludeExecutionData`, `S3OutputFormat`)
4. IAM permission management through `grantPush()` method
5. CloudFormation property mapping through `bind()` method

**Rationale:** EventBridge Event Buses and Pipes share identical logging requirements (same destinations, same service family), making the Pipes alpha module the logical foundation for consistent developer experience across EventBridge constructs.

### Other Information

No response

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS CDK Library version (aws-cdk-lib)

2.206.0

### AWS CDK CLI version

2.1021.0

### Environment details (OS name and version, etc.)

Ubuntu 24.04

Contributor guide

Open the contributing guide

Research direction

Start with the aws-events module's EventBus construct and compare the existing patterns in @aws-cdk/aws-pipes-alpha. Review the proposed destination interfaces, configuration enums, IAM permissions, and CloudFormation property mapping; done means EventBus supports the listed destinations and logging options with corresponding tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.