-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.alloy
More file actions
73 lines (63 loc) · 1.47 KB
/
config.alloy
File metadata and controls
73 lines (63 loc) · 1.47 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
loki.source.file "app_logs" {
targets = [
{
__path__ = "/var/log/app/*.log",
},
]
forward_to = [loki.process.app.receiver]
file_match {
enabled = true
sync_period = "10s"
}
}
loki.process "app" {
stage.json {
expressions = {
level = "level",
timestamp = "timestamp",
}
}
stage.timestamp {
source = "timestamp"
format = "RFC3339"
}
stage.static_labels {
values = {
job = "rpi-cam-plugin",
instance = sys.env("OBSERVABILITY_INSTANCE"),
}
}
stage.labels {
values = {
level = "",
}
}
forward_to = [loki.write.local.receiver]
}
loki.write "local" {
endpoint {
url = sys.env("LOKI_PUSH_URL")
}
}
// --- Metrics pipeline (optional) ---------------------------------------------
// Scrapes the plugin's /metrics endpoint and forwards to a Prometheus-compatible
// remote_write receiver. The whole pipeline no-ops cleanly when
// PROMETHEUS_REMOTE_WRITE_URL is empty: prometheus.scrape still runs but the
// remote_write sink drops samples if its url is blank.
prometheus.scrape "rpi_cam" {
targets = [
{
__address__ = "app:8018",
__metrics_path__ = "/metrics",
instance = sys.env("OBSERVABILITY_INSTANCE"),
job = "rpi-cam-plugin",
},
]
scrape_interval = "15s"
forward_to = [prometheus.remote_write.local.receiver]
}
prometheus.remote_write "local" {
endpoint {
url = sys.env("PROMETHEUS_REMOTE_WRITE_URL")
}
}