cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

[AWS::Events::EventBus] - [BUG] - Missing log destinations in `LogConfig`

Open garysassano opened this issue 1 year ago • 5 comments

Name of the resource

AWS::Events::EventBus

Resource Name

No response

Issue Description

Following this announcement, the LogConfig property was added to the AWS::Events::EventBus resource. The problem is that this new property only has the IncludeDetail and the Level properties:

Image

Because of this, there's no way to set and configure log destinations, as per the EventBridge docs:

Image

Expected Behavior

I expected the LogConfig property of the AWS::Events::EventBus resource to be similar to the PipeLogConfiguration property of AWS::Pipes::Pipe:

Image

Specifically, I don't see the following properties in LogConfig:

  • CloudwatchLogsLogDestination
  • FirehoseLogDestination
  • S3LogDestination

Observed Behavior

It's not possible to configure logging for AWS::Events::EventBus resource because there are missing properties.

Test Cases

See above.

Other Details

No response

garysassano avatar Jul 18 '25 22:07 garysassano

Hello,

EventBridge EventBus logging functions slightly different from Pipes in that the destinations are not configured within EventBridge at all but via CloudWatch's PutDeliveryDestination APIs. You'll need to create delivery sources, destinations, and deliveries on the CloudWatch side in order to setup logging correctly. This route aligns with other services that vend logs for our customers and consolidates these common APIs within CloudWatch.

https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html

https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-logs-deliverysource.html https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-logs-deliverydestination.html https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-logs-delivery.html

This particular API is as designed and this is not a bug.

Thanks, Scott

scabraha avatar Aug 22 '25 20:08 scabraha

This route aligns with other services that vend logs for our customers and consolidates these common APIs within CloudWatch.

@scabraha can you explain in which way this differs from configuring a lambda function with a LoggingConfig type as described here: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-lambda-function-loggingconfig.html

  ApplicationLogLevel: String
  LogFormat: String
  LogGroup: String
  SystemLogLevel: String

These are basically the same settings that are exposed to the user in the UI, same ability to choose a log destination in Cloudwatch, S3 or Firehose and with a log group the options would be very similar - so it's natural to expect to configure this in the same way instead of configuring all the Cloudwatch side on its own. I might just be missing something here!

hostvasco avatar Aug 23 '25 10:08 hostvasco

I was able to get this working as follows. Note I'm not an AWS employee and the AWS docs seem a bit lacking in this area so there may be better ways to do this. Note it also seems a bit temperamental if you've partially configured this and try to update it, so you may need to remove all this logging configuration and log groups etc. and try again from scratch if you're hitting issues on update.

Add the LogConfig section to your EventBus: If you have sensitive PII data in your events you may want to set IncludeDetail to NONE in higher envs like prod so these events aren't logged there but on in dev for debugging non-sensitive event bodies. Level can be ERROR, INFO or TRACE but you'll need to add extra sections below depending on the level - i.e. INFO is info and error logs, TRACE is trace, info and error logs. Example:

  MyEventBus:
    Type: AWS::Events::EventBus
    DeletionPolicy: !If [ IsHigherEnvironment, Retain, Delete ]
    UpdateReplacePolicy: !If [ IsHigherEnvironment, Retain, Delete ]
    Properties:
      Name: !Sub ${Environment}-event-bus
      LogConfig:
        IncludeDetail: !If [ IsHigherEnvironment, NONE, FULL ]
        Level: ERROR

Create the log group you wish to write the logs to, for example:

  StandardEventBusLogGroup:
    Type: AWS::Logs::LogGroup
    DeletionPolicy: Delete
    UpdateReplacePolicy: Delete
    Properties:
      LogGroupName: !Sub '/aws/vendedlogs/events/event-bus/${MyEventBus}'
      RetentionInDays: 30 # update as needed

Create the delivery source(s), for example: Repeat for info and trace if needed, remembering to update name as well e.g. ${MyEventBus}InfoDeliverySource. For info this is INFO_LOGS etc.

  ErrorLogsDeliverySource:
    Type: AWS::Logs::DeliverySource
    Properties:
      Name: !Sub '${MyEventBus}ErrorDeliverySource'
      ResourceArn: !GetAtt MyEventBus.Arn
      LogType: ERROR_LOGS

Create the destination - just need one of these:

  LogsDeliveryDestination:
    Type: AWS::Logs::DeliveryDestination
    Properties:
      Name: !Sub '${MyEventBus}DeliveryDestination'
      DestinationResourceArn: !GetAtt StandardEventBusLogGroup.Arn
      OutputFormat: json

Create the delivery - repeat for info and trace if needed - remember to update DeliverySourceName and DependsOn. Note if you're creating multiple of these at once the cloud formation can be a bit temperamental, so you may want to make them DependsOn the previous one so only one runs at a time (even though this shouldn't be needed):

  ErrorLogsDelivery:
    Type: AWS::Logs::Delivery
    DependsOn:
      - ErrorLogsDeliverySource
    Properties:
      DeliverySourceName: !Sub '${MyEventBus}ErrorDeliverySource'
      DeliveryDestinationArn: !GetAtt LogsDeliveryDestination.Arn

finbargp avatar Sep 09 '25 16:09 finbargp

@finbargp Thanks for sharing. I must admit that I'm quite impressed by how overly complex this is to configure.

To set up something as simple as an EventBridge Event Bus with only a CloudWatch Logs destination, you need:

  • AWS::Logs::LogGroup (1x)
  • AWS::Logs::DeliveryDestination (1x)
  • AWS::Logs::DeliverySource (1-3x, depending on the number of log levels)
  • AWS::Logs::Delivery (1-3x, depending on the number of log levels)

All of this, just to replicate what a single property like PipeLogConfiguration could have achieved.

garysassano avatar Sep 11 '25 20:09 garysassano

Adding an example to the AWS::Events::EventBus resource documentation would seemingly help a lot of customers, who may not easily find this thread.

I'm not sure how @finbargp figured it out, but I very much appreciate him sharing his findings here.

rhbecker avatar Sep 12 '25 22:09 rhbecker