Skip to content

About

AWS Lambda extension for forwarding logs to Better Stack

Resources

Stars

1 star

Watchers

1 watching

Forks

 
 

Repository files navigation

logtail-lambda-extension

Test logtail-lambda-extension E2E

AWS Lambda Extension that uses the Lambda Telemetry API to forward logs to a Better Stack HTTP source.

Usage

In order to use the extension you must first publish it as a Lambda layer in your AWS infrastructure. Download the latest release and publish it in the region of your Lambda function:

$ curl -fsSLO https://github.com/logtail/logtail-lambda-extension/releases/latest/download/logtail-lambda-extension.zip
$ aws lambda publish-layer-version \
      --layer-name "logtail-lambda-extension" \
      --zip-file "fileb://logtail-lambda-extension.zip" \
      --compatible-runtimes nodejs22.x nodejs24.x \
      --compatible-architectures x86_64 arm64

Every change to the extension on main is released automatically, see Releases.

To build the layer from source instead, run pnpm install and pnpm run build, then publish dist/logtail-lambda-extension.zip with the same command.

Once deployed set the SOURCE_TOKEN and INGESTING_HOST environment variables on your Lambda to the token and ingesting host from your Better Stack source settings (the ingesting host looks like s123456.lu-trq-1.betterstackdata.com), and add the layer to your Lambda function. On next invocation your Lambda logs should start appearing in Telemetry -> Live tail.

Environment Variables

Variable Description Default
SOURCE_TOKEN Better Stack source token required
INGESTING_HOST Better Stack ingesting host in.logs.betterstack.com
EXTENSION_NAME Name of the lambda extension logtail-lambda-extension
RECEIVER_ADDRESS Address of the logs http receiver sandbox
RECEIVER_PORT Port of the logs http receiver 4243
MAX_ITEMS Maximum number of events that can be buffered in memory 10000
MAX_BYTES Maximum size in bytes of events that can be buffered 262144
TIMEOUT_MS Maximum time (in milliseconds) that a batch is buffered 25
AWS_LAMBDA_RUNTIME_API HTTP base URI to the lambda runtime API Provided by AWS Lambda environment
AWS_LAMBDA_RUNTIME_EXTENSION_API_VERSION Lambda Extension API version date 2020-01-01
AWS_LAMBDA_RUNTIME_TELEMETRY_API_VERSION Telemetry API version date 2022-07-01

SOURCE_TOKEN and INGESTING_HOST fall back to the legacy LOGTAIL_TOKEN and LOGTAIL_HTTP_API_URL (a full URL) variables when they are not set.

License

Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. See LICENSE for more information.

About

AWS Lambda extension for forwarding logs to Better Stack

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages