Better Stack AWS Lambda Logging

Start logging in 2 minutes

Collect logs from your AWS Lambda running Python code.

1. Install

Install Logtail Python and AWS Lambda Powertools PyPI packages:

Install PyPI packages
pip3 install logtail-python
pip3 install aws-lambda-powertools

2. Setup

Set up AWS Lambda logger with Better Stack:

Set up Logtail handler
from logtail import LogtailHandler
from aws_lambda_powertools import Logger

handler = LogtailHandler(source_token="$SOURCE_TOKEN")
logger = Logger(service="example-service", logger_handler=handler, level="INFO")

3. Start logging ๐ŸŽ‰

Use the logger as usual:

Send logs to Logtail
logger.error('Something bad happened.')'Log message with structured logging.', extra={
    'item': "Orange Soda",
    'price': 100.00

You should see your logs in Better Stack -> Live tail.


Python version 3.7 or higher is required.
Pip version 20.0.2 or higher is required.

Need help?

Please let us know at
We're happy to help! ๐Ÿ™

Additional information

Interested in learning more about enriching log context and using formatters?
Head over to official AWS Lambda Powertools documentation.