Skip to content

toluna-terraform/terraform-coralogix-cloudwatch-integration

Repository files navigation

Lambda to forward logs from cloudwatch to coralogix Terraform module

Description

This module implement forwarding cloudwatch logs to coralogix. The original Lambda code was taken from their github repo: Coralogix Github under src/cloudwatch, and then modified the appName and subName parameters to read from created triggers and correlate to the matching environment and application (Coralogix: ApplicationName and SubSystem):

let appName = process.env.app_name+"-"+resultParsed.subscriptionFilters[0];
let subName = resultParsed.logGroup;

* an environment equals in it's name to the Terraform workspace it runs under so when referring to an environment or workspace throughout this document their value is actually the same.

The following resources will be created:

  • Lambda
  • Role and Policy for the Lambda
  • Log Group triggers for Lambda

Requirements

The module requires some pre conditions

Minimum requirements:

  • Pre defined SSM Parameter: "/infra/coralogix/apikey

Usage

module "coralogix" {
  source                      = "toluna-terraform/cloudwatch-integration/coralogix"
  app_name                    = local.app_name
  loggroup_envs               = local.loggroup_envs
  region                      = "us-east-1"
}

Requirements

Name Version
terraform >= 1.0.0
aws >= 3.59

Providers

Name Version
aws >= 3.59
null >= 3.1.0

Modules

Name Source Version
coralogix ../../

Resources

Name Type
resource
aws_iam_role resource
aws_iam_policy resource
aws_iam_role_policy_attachment resource
aws_lambda_function resource
aws_lambda_permission resource
aws_cloudwatch_log_subscription_filter resource
null_resource resource

Inputs

No inputs.

Outputs

No outputs.