Skip to content

Commit 05bae6a

Browse files
eugenep-scribdQingping Hou
authored andcommitted
feat: add EXCLUDE_AT_MATCH env variable to datadog
Datadog lambda will not send lines matching EXCLUDE_AT_MATCH, which will allow easy exclusion of unwanted events (such as container stopped due to autoscaling) By default it's set to $x^ which is a regexp lifted from stack overflow that doesn't match anything, so everything is included
1 parent 3280df3 commit 05bae6a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

logshipping.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ resource "aws_lambda_function" "dd-log" {
9797

9898
environment {
9999
variables = {
100-
DD_API_KEY = var.datadog_api_key
101-
DD_TAGS = "namespace:${var.namespace},env:${var.env}"
100+
DD_API_KEY = var.datadog_api_key
101+
DD_TAGS = "namespace:${var.namespace},env:${var.env}"
102+
EXCLUDE_AT_MATCH = var.log_exclude_at_match
102103
}
103104
}
104105
}

vars.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ variable "elb_logs_bucket_prefix" {
5757
type = string
5858
default = "awsdd"
5959
}
60+
variable "log_exclude_at_match" {
61+
description = "Sets EXCLUDE_AT_MATCH environment variable, which allows excluding unwanted log lines"
62+
type = "string"
63+
default = "$x^" # <- never matches anything
64+
}

0 commit comments

Comments
 (0)