Skip to content

Automate the subscription of a cloudwatch log group to an ElasticSearch endpoint

Notifications You must be signed in to change notification settings

jparnaudeau/terraform-aws-cloudwatch-subscription-elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-cloudwatch-subscription-elasticsearch

This module is responsible to subscribe a cloudwatch logs to an ElasticSearch domain. It have been designed for a specific need, regarding the indexation of rds logs. This module is not generic.

This module will :

  • deploy a lambda function with the AWS official code that ready to stream a cloudwatch logs. The uniq update is to pass the elasticsearch domain endpoint in environment variable of the lambda instead "hardcoded" value as it's done when you create the subscription filter from the console.
  • deploy the subscription filter on the cloudwatch log group to the lambda.
  • Think about to allow, in the elasticsearch domain policy, the role of the lambda.

Refer to this example to see the initial use of this module. Create Issue on my github if you want that i push a more generic module.

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

Name Source Version
lambda terraform-aws-modules/lambda/aws 2.34.0

Resources

Name Type
aws_cloudwatch_log_subscription_filter.rds_cw_subscription resource
aws_lambda_permission.cloudwatch-logs-invoke-elasticsearch-lambda resource
aws_cloudwatch_log_group.rds_logs data source

Inputs

Name Description Type Default Required
environment The Environment label string "test" no
es_domain_endpoint The ElasticSearch Domain endpoint string n/a yes
function_name The lambda function name. Format lbd-{environment}-{function_name} string "stream-logs" no
lambda_role_arn The Lambda Role ARN string n/a yes
rds_cloudwatch_log_name The Name of the Cloudwatch Log for RDS Instance for which we want stream logs string n/a yes
rds_name The RDS Identifier for which we want stream logs string n/a yes
region The AWS Region string "eu-west-3" no
source_account_id The AWS Source Account Id string n/a yes
tags A map of tags map(string) {} no

Outputs

Name Description
lambda_function_arn The ARN of the Lambda Function
lambda_function_invoke_arn The Invoke ARN of the Lambda Function
lambda_function_last_modified The date Lambda Function resource was last modified
lambda_function_name The name of the Lambda Function
lambda_function_qualified_arn The ARN identifying your Lambda Function Version
lambda_function_version Latest published version of Lambda Function
streamed_cloudwatch_log_arn The CloudWatch Log name that it streamed by the Lambda Function
streamed_cloudwatch_log_name The CloudWatch Log name that it streamed by the Lambda Function

About

Automate the subscription of a cloudwatch log group to an ElasticSearch endpoint

Resources

Stars

Watchers

Forks

Packages

No packages published