Coralogix Extensions for AWS Lambda

Description

Coralogix can now use aws Lambda extensions to read Lambda functions’ logs and metrics directly without having to use Cloudwatch, thereby reducing latency and cost while gaining observability into your serverless infrastructure.

Usage

  1. Go to AWS Serverless Repository and Search for Coralogix. Select Coralogix-Lambda-Extension
  2. List the appropriate runtime environments for your lambdas and click ‘Deploy’
  3. Validate that the extension is available as a Lambda layer your account
  4. Go to the Lambda function from which you want to send logs to Coralogix, choose the ‘Layers’ component, and click ‘Add Layer’
  5. Select Custom Layers, choose the coralogix-extension layer, select the latest version and click ‘Add’
  6. Go to the environment variables section in your Lambda function and add the below 3 parameters.
    This document includes cluster-dependent URL’s. Each URL has a variable part (in Italic). Please match this part with a row entry within the following table. Copy the table row entry located under the column that matches the top-level domain of your Coralogix account (.com, .in, etc.). Replace the variable part of the URL with this entry.
     .com.us.in
    Elasticsearch-APIhttps://coralogix-esapi.coralogix.com:9443https://esapi.coralogix.us:9443https://es-api.app.coralogix.in:9443
    SSL Certificateshttps://coralogix-public.s3-eu-west-1.amazonaws.com/certificate/Coralogix-EU.crthttps://www.amazontrust.com/repository/AmazonRootCA1.pemhttps://coralogix-public.s3-eu-west-1.amazonaws.com/certificate/Coralogix-IN
    .pem
    Cluster URLcoralogix.comcoralogix.usapp.coralogix.in
  7. CORALOGIX_PRIVATE_KEY – A unique ID that represents your company. The private key can be found under ‘settings’->’ send your logs’. It is located in the upper left corner.
  8. CORALOGIX_APP_NAME – A mandatory metadata field that is sent with the logs. Helps identify the logs sent by this Lambda function.
  9. CORALOGIX_SUB_SYSTEM – A mandatory metadata field sent with the logs. Helps identify the logs sent by this Lambda function. Your application probably has multiple subsystems, for example, Backend, Middleware, Frontend, etc.
  10. CORALOGIX_LOG_URL (Optional) – If your Coralogix account top level domain is different than ‘.com’,  use https://api.Cluster URL/api/v1/logs
  11. Finally, click ‘Add’

Container image lambda

In case if you deploy your lambda as a container image, to inject extension as part of your function just copy below to your image:
you can read more about it here

FROM coralogixrepo/coralogix-lambda-extension:latest AS coralogix-extension
FROM public.ecr.aws/lambda/python:3.8
# Layer code
WORKDIR /opt
COPY --from=coralogix-extension /opt/ .
# Function code
WORKDIR /var/task
COPY app.py .
CMD ["app.lambda_handler"]

Automation

You can include SAM (Serverless Application Model) in your automation frameworks. If you need access to the latest Lambda code go to https://github.com/coralogix/coralogix-aws-serverless/tree/master/src.

 

Your all set! Data will begin streaming to Coralogix. Need any help with your integration? ping us on our in-app chat or at  support@coralogix.com.