-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalertloop.example.yaml
More file actions
151 lines (140 loc) · 6.36 KB
/
Copy pathalertloop.example.yaml
File metadata and controls
151 lines (140 loc) · 6.36 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
# AlertLoop example configuration.
# Precedence (highest wins): command flags > environment variables > this file >
# built-in defaults.
#
# What accepts an ALERTLOOP_* env var: addr, admin_token, database driver/dsn,
# log level/format/file, retention_days, cors_origins, plus two worker knobs
# (ALERTLOOP_WORKER_CONCURRENCY, ALERTLOOP_WORKER_MAX_ATTEMPTS) and the
# rate-limit on/off switch (ALERTLOOP_RATELIMIT_ENABLED). See .env.example.
#
# YAML only: structured lists (api_keys, channels) and the remaining
# worker/rate_limit tuning (poll_interval, base_backoff, max_backoff,
# per_ip_*, ingest_*).
# HTTP listen address for the API and web UI.
addr: ":8080"
# Admin token protects the events web page and the admin console at /admin, and
# grants FULL API access (it is the admin console credential). CHANGE THIS.
admin_token: "change-me-admin-token"
# API keys for services calling the JSON API. Each key has a scope:
# ingest - may only create events (POST /v1/events) → for event sources
# read - may only read events/deliveries/stats → for dashboards
# full - full access incl. state actions and replay → for trusted tools
# Omitted scope defaults to full. The admin token already has full access, so
# keys are optional (e.g. only needed for least-privilege service credentials).
api_keys:
- key: "change-me-ingest-key"
scope: ingest
# - key: "change-me-read-key"
# scope: read
# Event retention window in days: events older than this are pruned automatically
# by the worker. Configurable here or via ALERTLOOP_RETENTION_DAYS; no upper bound.
retention_days: 30
# Logging. Output goes to stdout by default; set `file` to also persist logs to
# disk so external tools (tail, Loki, Vector, journald) can read them.
log:
level: "info" # debug | info | warn | error
format: "text" # text (human-readable) | json (for log processors)
file: "" # empty = stdout; e.g. "/var/log/alertloop/alertloop.log"
# In-process rate limiting. If you run behind a reverse proxy that already rate
# limits, you may set enabled: false and limit there instead.
rate_limit:
enabled: true
per_ip_per_second: 20 # requests per second per client IP
per_ip_burst: 40
ingest_per_second: 100 # overall event ingestion cap for the process
ingest_burst: 200
# The admin console is served by this API at /admin (same origin — no CORS
# needed). Only set cors_origins if you build your OWN browser app on a
# different origin that calls this API. Use "*" to allow any origin; empty (the
# default) disables CORS and allows same-origin only.
# cors_origins:
# - "https://my-dashboard.example.com"
database:
# "sqlite" (local/demo) or "postgres" (production). Inferred from dsn if empty.
driver: "sqlite"
# SQLite: a file path or ":memory:".
# PostgreSQL: e.g. "postgres://user:pass@host:5432/alertloop?sslmode=disable".
dsn: "alertloop.db"
worker:
concurrency: 2
poll_interval: 2s
max_attempts: 5 # tries before a delivery is dead-lettered
base_backoff: 30s # first retry delay; doubles each attempt
max_backoff: 30m # cap on the retry delay
# Delivery channels are OPTIONAL. With none configured (as below), AlertLoop
# simply stores events (visible in the API and at /admin) and delivers nothing —
# this is a perfectly valid way to run. To send notifications, uncomment one or
# more channels and fill in their fields.
#
# Each type is a LIST, so you can configure several channels of the same type
# (e.g. two Telegram chats). Without a `routing` section (see below) every event
# is delivered to EVERY configured channel. Each channel needs a unique `name`.
# If you enable a channel you must fill ALL its required fields, or startup will
# fail with a clear message.
channels: {}
# email:
# - name: dev-email
# host: "smtp.example.com"
# port: 587
# username: "alerts@example.com"
# password: "app-password"
# from: "alerts@example.com"
# to: ["ops@example.com"]
# starttls: true # require STARTTLS on a plaintext port (e.g. 587)
# tls: false # set true for implicit TLS / SMTPS (e.g. port 465)
#
# telegram:
# - name: dev-telegram
# bot_token: "123456:ABC-DEF" # from @BotFather
# chat_id: "-1001234567890"
# # If this host cannot reach api.telegram.org directly, send this
# # channel's requests through a proxy. Schemes: http, https, socks5,
# # socks5h (socks5h is a synonym: the proxy resolves DNS either way).
# # MTProto proxies do NOT work for the Bot API. Any other scheme stops
# # startup. Leave it out to keep using HTTP_PROXY/HTTPS_PROXY, if set.
# # proxy: "socks5://user:pass@127.0.0.1:1080"
# #
# # Alternative to a proxy: a trusted Bot API mirror or reverse proxy.
# # api_base: "https://tg-mirror.example.com"
#
# - name: customer-telegram
# bot_token: "123456:ABC-DEF"
# chat_id: "-1009876543210"
#
# webhook:
# - name: siem
# url: "https://example.com/alertloop-hook"
# # Requests are HMAC-SHA256 signed; receivers verify X-AlertLoop-Signature.
# secret: "shared-webhook-secret"
# Routing is OPTIONAL. Without this section every event goes to every configured
# channel (the behaviour of 0.1.x). With it, each event goes to the channels of
# the FIRST rule it matches — rules are checked top to bottom and channel lists
# are never merged.
#
# The example below is the common split: the customer gets the orders, the
# developer gets the failures, and neither gets the other's events.
#
# routing:
# rules:
# # Suppression first: a rule that silences a source must sit above the
# # rules it overrides, because the first match wins.
# - name: silence-healthchecks
# match:
# source: [healthcheck]
# channels: [] # explicit "nowhere": stored, never delivered
#
# - name: incidents-to-dev
# match:
# type: [incident] # values in one field are OR-ed...
# min_severity: warning # ...and different fields are AND-ed
# channels: [dev-telegram, dev-email]
#
# - name: orders-to-customer
# match:
# type: [business_event]
# category: ["order.*"] # only a TRAILING "*" is supported
# channels: [customer-telegram]
#
# # Events matching no rule. Omit it and they are delivered nowhere — each one
# # is then logged at warn level so the loss is never silent.
# default: [dev-telegram]