Logs Collection

Using Lambda Layers, you can configure your Lambda functions to start sending logs to Lumigo.

Quickstart guide

To enable logging for your lambda manually:

  1. Add the logging layer according to your architecture.

📘

Make sure to update the <REGION> according to your lambda

  • ARM: arn:aws:lambda:<REGION>:114300393969:layer:lumigo-log-collector-arm64:15
  • x86: arn:aws:lambda:<REGION>:114300393969:layer:lumigo-log-collector-amd64:15
  1. Add the following environment variable, make sure to replace the token with your Lumigo token, available at the settings page.

To enable logging for your lambda automatically (AWS Tag):

You can automatically enable Lumigo logging by adding the following AWS tag to your Lambda functions:

LUMIGO_LOG_COLLECTION: true

Lumigo periodically scans Lambda functions in your environment for the LUMIGO_LOG_COLLECTION AWS tag. When Lumigo identifies a Lambda function with the LUMIGO_LOG_COLLECTION AWS tag, it automatically adds the Lumigo logging layer and Lumigo endpoint.

📘

Important Note (!)

It could take several minutes for Lumigo to identify the tag and instrument your function, which is why this installation method is NOT recommended to be used in Production.

Requirements for Lumigo Log Management

In order to use Lumigo's Logging Layer:

  1. The Lambda's unzipped total deployment package size must not exceed 250MB. This is an AWS limit for all Lambda deployments. The Lumigo log layer adds around 12MB.
  2. Custom Runtimes for Lambda do not support layers.
  3. For Lambdas that use Aliases, the layer can be added by adding the layer directly during deployment.

Modes of sending logs to Lumigo

There are two modes of sending logs to Lumigo:

  • On next invocation - invocation logs are buffered in the Lambda container and sent on the next function invocation in parallel to its execution. This parallelization results in virtually no latency addition to the function execution time. This is the default mode and the recommended mode for production.
    In the event that there isn't a subsequent invocation, it may take up to 5 minutes for logs to be sent to Lumigo.
  • On invocation end - Logs are sent to Lumigo at the end of each invocation. This mode is recommended in cases where many minutes can pass between function invocations, and added invocation duration is not significant (e.g. developers debugging in their dev environment)

To change the log sending mode for a Lambda function, add the following environment variable:
LUMIGO_SEND_ON_INVOCATION_END:true

Shutdown sending logs

To disable sending logs from your lambda functions, you should set/update the following AWS tag:

LUMIGO_LOG_COLLECTION: false

Log collection from containerized lambda functions

To use Lumigo's lambda extension, the binary should be copied to /opt/extensions/.

📘

Supported architecture

The Lumigo log collection extension supports both amd64 and arm64 architectures.

To add the extension to the required path, add the two lines below in your dockerfile:

FROM public.ecr.aws/lumigo/lumigo-log-collection-extension:19 as lumigo-log-collecting-extension
COPY --from=lumigo-log-collecting-extension /opt/extensions/log-collector-extension /opt/extensions/log-collector-extension

Please refer to the example below on how to add the extension to your dockerfile:

FROM public.ecr.aws/lumigo/lumigo-log-collection-extension:19 as lumigo-log-collecting-extension
FROM public.ecr.aws/lambda/nodejs:18 as builder
WORKDIR /usr/app
COPY package.json index.ts  ./
RUN npm install
RUN npm run build
FROM public.ecr.aws/lambda/nodejs:18
COPY --from=lumigo-log-collecting-extension /opt/extensions/log-collector-extension /opt/extensions/log-collector-extension
WORKDIR ${LAMBDA_TASK_ROOT}
COPY --from=builder /usr/app/dist/* ./
CMD ["index.handler"]