AWS Lambda Extension that uses the Lambda Telemetry API to forward logs to a Logtail HTTP API source.
In order to use the extension you must first build and deploy it into your AWS infrastructure:
$ git clone [email protected]:stockstory/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 nodejs20.x \
--compatible-architectures x86_64 arm64
Once deployed set the LOGTAIL_TOKEN
environment variable on your Lambda to your HTTP API source from Logtail, and add the layer to your Lambda function.
On next invocation your Lambda logs should start appearing in your Logtail console.
Variable | Description | Default |
---|---|---|
LOGTAIL_TOKEN | Logtail source bearer token | required |
LOGTAIL_HTTP_API_URL | Logtail HTTP source ingestion API URL | https://in.logtail.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 |
Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. See LICENSE for more information.