-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.tf
More file actions
69 lines (56 loc) · 1.91 KB
/
Copy pathmain.tf
File metadata and controls
69 lines (56 loc) · 1.91 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
# =============================================================================
# Sources
# =============================================================================
resource "logtail_source" "this" {
name = "Terraform Basic Source"
platform = "http"
}
resource "logtail_errors_application" "this" {
name = "Terraform Basic Errors Application"
platform = "ruby_errors"
correlate_with_source_id = logtail_source.this.id
}
# =============================================================================
# Explorations - Basic Examples
# =============================================================================
# Line chart - event count over time
resource "logtail_exploration" "event_count" {
name = "Event Count Over Time"
chart {
chart_type = "line_chart"
description = "Shows the number of events over time"
}
query {
query_type = "sql_expression"
sql_query = "SELECT {{time}} AS time, count(*) AS value FROM {{source}} WHERE time BETWEEN {{start_time}} AND {{end_time}} GROUP BY time"
}
}
# Tail chart - live log view with filter
resource "logtail_exploration" "error_logs" {
name = "Terraform Explore Errors"
chart {
chart_type = "tail_chart"
description = "Live view of error logs"
}
query {
query_type = "tail_query"
where_condition = "level=error"
}
variable {
name = "source"
variable_type = "source"
values = [logtail_source.this.id]
}
}
# =============================================================================
# Simple Alert
# =============================================================================
resource "logtail_exploration_alert" "error_logs" {
exploration_id = logtail_exploration.error_logs.id
name = "Terraform Errors Alert"
alert_type = "threshold"
operator = "higher_than"
value = 0
check_period = 60
email = true
}