Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fe4f965
feat(events): add support for Event Bus Logging Configuration
duranbe Aug 10, 2025
1af266f
Merge branch 'main' into add-log-config
duranbe Aug 13, 2025
744581a
Update integ test and snapshot
duranbe Aug 13, 2025
7ebf48e
fix integ test by running them correctly
duranbe Aug 13, 2025
26794fc
update Readme
duranbe Aug 13, 2025
5339de2
Merge branch 'main' into add-log-config
duranbe Aug 13, 2025
aaea6d6
fix: add imports to ts example code for Rosetta
duranbe Aug 13, 2025
273ae0a
fix rosetta build error
duranbe Aug 13, 2025
4fd41dd
Merge branch 'main' into add-log-config
duranbe Aug 13, 2025
22e31bf
fix readme and integ test
duranbe Aug 13, 2025
a501477
Merge branch 'main' into add-log-config
duranbe Aug 13, 2025
c951401
fix readme
duranbe Aug 13, 2025
6b3d3ac
Merge branch 'main' into add-log-config
duranbe Aug 13, 2025
535b82e
Merge branch 'main' into add-log-config
duranbe Aug 18, 2025
763527c
Merge branch 'main' into add-log-config
duranbe Aug 19, 2025
7cf356e
Merge branch 'main' into add-log-config
duranbe Aug 19, 2025
e2c589c
Merge branch 'main' into add-log-config
duranbe Aug 20, 2025
fb3bb5f
Merge branch 'main' into add-log-config
duranbe Aug 21, 2025
dd955df
Update README.md
duranbe Aug 21, 2025
38237a7
Merge branch 'main' into add-log-config
duranbe Aug 24, 2025
6a6c733
Merge branch 'main' into add-log-config
duranbe Aug 25, 2025
ba99f24
Merge branch 'main' into add-log-config
mergify[bot] Aug 26, 2025
e80b58d
Merge branch 'main' into add-log-config
duranbe Aug 27, 2025
72db3af
Merge branch 'main' into add-log-config
duranbe Aug 30, 2025
5bf9ae1
Merge branch 'main' into add-log-config
duranbe Sep 1, 2025
59916db
Merge branch 'main' into add-log-config
duranbe Sep 3, 2025
476b693
Merge branch 'main' into add-log-config
duranbe Sep 8, 2025
5534c70
Merge branch 'main' into add-log-config
duranbe Sep 15, 2025
02e1330
Merge branch 'main' into add-log-config
alvazjor Sep 17, 2025
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
61 changes: 61 additions & 0 deletions packages/aws-cdk-lib/aws-events/lib/event-bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,61 @@ import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-re
import { propertyInjectable } from '../../core/lib/prop-injectable';
import * as cxapi from '../../cx-api';

/**
* Whether EventBridge include detailed event information in the records it generates.
* Detailed data can be useful for troubleshooting and debugging.
* This information includes details of the event itself, as well as target details.
*/
export enum IncludeDetail {
/**
* FULL: Include all details related to event itself and the request EventBridge sends to the target.
* Detailed data can be useful for troubleshooting and debugging.
*/
FULL = 'FULL',
/**
* NONE: Does not include any details.
*/
NONE = 'NONE',
}

/**
* The level of logging detail to include. This applies to all log destinations for the event bus.
*/
export enum Level {
/**
* INFO: EventBridge sends any logs related to errors, as well as major steps performed during event processing
*/
INFO = 'INFO',
/**
* ERROR: EventBridge sends any logs related to errors generated during event processing and target delivery.
*/
ERROR = 'ERROR',
/**
* TRACE: EventBridge sends any logs generated during all steps in the event processing.
*/
TRACE = 'TRACE',
/**
* OFF: EventBridge does not send any logs. This is the default.
*/
OFF = 'OFF',
}

/**
* Interface for Logging Configuration of the Event Bus
*/
export interface LogConfig {
/**
* Whether EventBridge include detailed event information in the records it generates.
* @default no details
*/
readonly includeDetail?: IncludeDetail;
/**
* Logging level
* @default OFF
*/
readonly level?: Level;
}

/**
* Interface which all EventBus based classes MUST implement
*/
Expand Down Expand Up @@ -112,6 +167,11 @@ export interface EventBusProps {
* @default - Use an AWS managed key
*/
readonly kmsKey?: kms.IKey;
/**
* The Logging Configuration of the Èvent Bus.
* @default - no logging
*/
readonly logConfig?: LogConfig;
}

/**
Expand Down Expand Up @@ -405,6 +465,7 @@ export class EventBus extends EventBusBase {
} : undefined,
description: props?.description,
kmsKeyIdentifier: props?.kmsKey?.keyArn,
logConfig: props?.logConfig,
});

this.eventBusArn = this.getResourceArnAttribute(eventBus.attrArn, {
Expand Down
24 changes: 23 additions & 1 deletion packages/aws-cdk-lib/aws-events/test/event-bus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as iam from '../../aws-iam';
import * as kms from '../../aws-kms';
import * as sqs from '../../aws-sqs';
import { Aws, CfnResource, Stack, Arn, App, PhysicalName, CfnOutput } from '../../core';
import { EventBus } from '../lib';
import { EventBus, IncludeDetail, Level } from '../lib';

describe('event bus', () => {
test('default event bus', () => {
Expand All @@ -20,6 +20,28 @@ describe('event bus', () => {
});
});

test('default event bus with logConfig', () => {
// GIVEN
const stack = new Stack();

// WHEN
new EventBus(stack, 'Bus', {
logConfig: {
includeDetail: IncludeDetail.FULL,
level: Level.TRACE,
},
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Events::EventBus', {
Name: 'Bus',
LogConfig: {
IncludeDetail: 'FULL',
Level: 'TRACE',
},
});
});

test('default event bus with empty props object', () => {
// GIVEN
const stack = new Stack();
Expand Down
Loading