Skip to content

logtail/logtail-lambda-extension

 
 

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

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 1000
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

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 91.4%
  • JavaScript 7.6%
  • Shell 1.0%