Skip to content

Repository files navigation

logtail-lambda-extension

Test logtail-lambda-extension

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 build and deploy it into your AWS infrastructure:

$ git clone git@github.com:logtail/logtail-lambda-extension.git
$ cd logtail-lambda-extension
$ pnpm install
$ pnpm run build
$ aws lambda publish-layer-version \
--layer-name "logtail-lambda-extension" \
--zip-file "fileb://./dist/extension.zip" \
--compatible-runtimes nodejs22.x nodejs24.x \
--compatible-architectures x86_64 arm64

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

VariableDescriptionDefault
SOURCE_TOKENBetter Stack source tokenrequired
INGESTING_HOSTBetter Stack ingesting hostin.logs.betterstack.com
EXTENSION_NAMEName of the lambda extensionlogtail-lambda-extension
RECEIVER_ADDRESSAddress of the logs http receiversandbox
RECEIVER_PORTPort of the logs http receiver4243
MAX_ITEMSMaximum number of events that can be buffered in memory10000
MAX_BYTESMaximum size in bytes of events that can be buffered262144
TIMEOUT_MSMaximum time (in milliseconds) that a batch is buffered1000
AWS_LAMBDA_RUNTIME_APIHTTP base URI to the lambda runtime APIProvided by AWS Lambda environment
AWS_LAMBDA_RUNTIME_EXTENSION_API_VERSIONLambda Extension API version date2020-01-01
AWS_LAMBDA_RUNTIME_TELEMETRY_API_VERSIONTelemetry API version date2022-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

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages