EventSourceMappingLogLevel

class aws_cdk.aws_lambda.EventSourceMappingLogLevel(*values)

Bases: Enum

The log level for the event source mapping poller.

Controls the verbosity of logs generated by the polling infrastructure. Different log levels provide varying amounts of detail:

  • INFO: Standard operational information suitable for production monitoring

  • DEBUG: Detailed diagnostic information for development and troubleshooting

  • WARN: Warning messages and potential issues that don’t prevent normal operation

These logs are separate from your Lambda function’s application logs and focus on the event source mapping’s internal operations such as connection management, polling behavior, and infrastructure-level error conditions.

// Configure INFO level logging for production monitoring let func: lambda.IFunction; const eventSourceMapping = func.addEventSourceMapping(eventSourceMappingName, { logLevel: lambda.EventSourceMappingLogLevel.INFO });

// Configure DEBUG level logging for detailed troubleshooting let func: lambda.IFunction; const eventSourceMapping = func.addEventSourceMapping(eventSourceMappingName, { logLevel: lambda.EventSourceMappingLogLevel.DEBUG });

ExampleMetadata:

infused

Example:

from aws_cdk.aws_lambda_event_sources import ProvisionedPollerConfig
from aws_cdk.aws_lambda_event_sources import ManagedKafkaEventSource

# my_function: lambda.Function


# Your MSK cluster arn
cluster_arn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4"

# Configure INFO level logging for production monitoring
my_function.add_event_source(ManagedKafkaEventSource(
    cluster_arn=cluster_arn,
    topic="production-events",
    starting_position=lambda_.StartingPosition.LATEST,
    # Provisioned mode is required for observability features
    provisioned_poller_config=ProvisionedPollerConfig(
        minimum_pollers=1,
        maximum_pollers=5
    ),
    log_level=lambda_.EventSourceMappingLogLevel.INFO
))

Attributes

DEBUG

Detailed information for poller debugging.

INFO

Messages that record the normal operation of your poller.

WARN

Messages about potential errors that may lead to unexpected behavior if unaddressed.