-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathapp.tf
More file actions
161 lines (157 loc) · 8.01 KB
/
Copy pathapp.tf
File metadata and controls
161 lines (157 loc) · 8.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
module "classic_elb_module" {
source = "SumoLogic/sumo-logic-integrations/sumologic//sumologic"
access_id = var.access_id
access_key = var.access_key
environment = var.environment
# ********************** Required Fields and FERs are created at aws-observability-terraform/field.tf ********************** #
# ********************** Apps ********************** #
managed_apps = {
"ClassicLBApp" = {
content_json = join("", [var.json_file_directory_path, "/aws-observability/json/Classic-lb-App.json"])
folder_id = var.app_folder_id
}
}
# ********************** Monitors ********************** #
managed_monitors = {
"AWSClassicLoadBalancerAccessfromHighlyMaliciousSources" = {
monitor_name = "AWS Classic Load Balancer - Access from Highly Malicious Sources"
monitor_description = "This alert fires when the Classic load balancer is accessed from highly malicious IP addresses within last 5 minutes."
monitor_monitor_type = "Logs"
monitor_parent_id = var.monitor_folder_id
monitor_is_disabled = var.monitors_disabled
monitor_evaluation_delay = "0m"
queries = {
A = "account=* region=* namespace=aws/elb\n| parse \"* * * * * * * * * * * \\\"*\\\" \\\"*\\\" * *\" as datetime, loadbalancername, client, backend, request_processing_time, backend_processing_time, response_processing_time, elb_status_code, backend_status_code, received_bytes, sent_bytes, request, user_agent, ssl_cipher, ssl_protocol\n| parse regex \"(?<ClientIp>\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\" multi\n| where ClientIp != \"0.0.0.0\" and ClientIp != \"127.0.0.1\"\n| count as ip_count by ClientIp, loadbalancername, account, region, namespace\n| threatlookup singleIndicator ClientIp\n| where (_threatlookup.type=\"ipv4-addr:value\" or _threatlookup.type=\"ipv6-addr:value\") and !isNull(_threatlookup.confidence)\n| if (isEmpty(_threatlookup.actors), \"Unassigned\", _threatlookup.actors) as actor\n| if (_threatlookup.confidence >= 85, \"high\", if (_threatlookup.confidence >= 50, \"medium\", if (_threatlookup.confidence >= 15, \"low\", if (_threatlookup.confidence >= 0, \"unverified\", \"Unknown\")))) as MaliciousConfidence\n| where MaliciousConfidence=\"high\"\n| sum (ip_count) as ThreatCount by ClientIp, loadbalancername, account, region, namespace, MaliciousConfidence, Actor"
}
triggers = [
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "Critical",
threshold = 0,
threshold_type = "GreaterThan",
occurrence_type = "ResultCount",
trigger_source = "AllResults"
},
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "ResolvedCritical",
threshold = 0,
threshold_type = "LessThanOrEqual",
occurrence_type = "ResultCount",
trigger_source = "AllResults"
}
]
group_notifications = var.group_notifications
connection_notifications = var.connection_notifications
email_notifications = var.email_notifications
},
"AWSClassicLoadBalancerHigh4XXErrors" = {
monitor_name = "AWS Classic Load Balancer - High 4XX Errors"
monitor_description = "This alert fires where there are too many HTTP requests (>5%) with a response status of 4xx within an interval of 5 minutes."
monitor_monitor_type = "Metrics"
monitor_parent_id = var.monitor_folder_id
monitor_is_disabled = var.monitors_disabled
monitor_evaluation_delay = "4m"
queries = {
A = "Namespace=aws/elb metric=HTTPCode_ELB_4XX Statistic=Sum account=* region=* loadbalancername=* | sum by loadbalancername, account, region, namespace"
B = "Namespace=aws/elb metric=RequestCount Statistic=Sum account=* region=* loadbalancername=* | sum by loadbalancername, account, region, namespace"
C = "#A * 100 / #B along loadbalancername, account, region, namespace"
}
triggers = [
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "Critical",
threshold = 5,
threshold_type = "GreaterThanOrEqual",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
},
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "ResolvedCritical",
threshold = 5,
threshold_type = "LessThan",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
}
]
group_notifications = var.group_notifications
connection_notifications = var.connection_notifications
email_notifications = var.email_notifications
},
"AWSClassicLoadBalancerHighLatency" = {
monitor_name = "AWS Classic Load Balancer - High Latency"
monitor_description = "This alert fires when we detect that the average latency for a given Classic load balancer within a time interval of 5 minutes is greater than or equal to three seconds."
monitor_monitor_type = "Metrics"
monitor_parent_id = var.monitor_folder_id
monitor_is_disabled = var.monitors_disabled
monitor_evaluation_delay = "4m"
queries = {
A = "Namespace=aws/elb metric=Latency Statistic=Average account=* region=* loadbalancername=* | eval(_value*1000) | sum by account, region, namespace, loadbalancername"
}
triggers = [
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "Critical",
threshold = 3000,
threshold_type = "GreaterThanOrEqual",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
},
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "ResolvedCritical",
threshold = 3000,
threshold_type = "LessThan",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
}
],
group_notifications = var.group_notifications
connection_notifications = var.connection_notifications
email_notifications = var.email_notifications
},
"AWSClassicLoadBalancerHigh5XXErrors" = {
monitor_name = "AWS Classic Load Balancer - High 5XX Errors"
monitor_description = "This alert fires where there are too many HTTP requests (>5%) with a response status of 5xx within an interval of 5 minutes."
monitor_monitor_type = "Metrics"
monitor_parent_id = var.monitor_folder_id
monitor_is_disabled = var.monitors_disabled
monitor_evaluation_delay = "4m"
queries = {
A = "Namespace=aws/elb metric=HTTPCode_ELB_5XX Statistic=Sum account=* region=* loadbalancername=* | sum by loadbalancername, account, region, namespace"
B = "Namespace=aws/elb metric=RequestCount Statistic=Sum account=* region=* loadbalancername=* | sum by loadbalancername, account, region, namespace"
C = "#A * 100 / #B along loadbalancername, account, region, namespace"
}
triggers = [
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "Critical",
threshold = 5,
threshold_type = "GreaterThanOrEqual",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
},
{
detection_method = "StaticCondition",
time_range = "-5m",
trigger_type = "ResolvedCritical",
threshold = 5,
threshold_type = "LessThan",
occurrence_type = "Always",
trigger_source = "AnyTimeSeries"
}
],
group_notifications = var.group_notifications
connection_notifications = var.connection_notifications
email_notifications = var.email_notifications
}
}
}