1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00

loki/prometheus: Add plumbing for using loki recording rules[1]

The plan is to use this for creating metrics from the nginx log lines
(e.g. requests per second).

[1] https://grafana.com/docs/loki/latest/alert/#recording-rules
This commit is contained in:
Kristian Klausen 2024-08-18 16:50:55 +02:00
parent 12fbdc5401
commit c9e9b3c6f9
No known key found for this signature in database
GPG Key ID: E2BE346E410366C3
4 changed files with 23 additions and 2 deletions

@ -12,7 +12,7 @@ common:
storage:
filesystem:
chunks_directory: /var/lib/loki/chunks
rules_directory: /var/lib/loki/rules
rules_directory: /etc/loki/rules
replication_factor: 1
instance_addr: 127.0.0.1
ring:
@ -25,6 +25,16 @@ ingester:
replay_memory_ceiling: 200MB
chunk_encoding: zstd
ruler:
rule_path: /var/lib/loki/rules-tmp
wal:
dir: /var/lib/loki/ruler-wal
remote_write:
enabled: true
clients:
local:
url: http://127.0.0.1:9090/api/v1/write
schema_config:
configs:
- from: 2022-06-07

@ -0,0 +1 @@
groups: []

@ -5,6 +5,16 @@
copy: src=loki.yaml dest=/etc/loki/ owner=root group=root mode=0644
notify: Restart loki
- name: Create directories for loki recording rules
file: path={{ item }} state=directory owner=root group=root mode=0755
loop:
- /etc/loki/rules
- /etc/loki/rules/fake
- name: Install loki recording rules
copy: src=rules.yaml dest=/etc/loki/rules/fake/ owner=root group=root mode=0644
notify: Restart loki
- name: Make nginx log dir
file: path=/var/log/nginx/loki state=directory owner=root group=root mode=0755

@ -1,5 +1,5 @@
{% if prometheus_receive_only %}
PROMETHEUS_ARGS="--storage.tsdb.retention.time=365d --web.enable-remote-write-receiver --web.config.file=/etc/prometheus/web-config.yml --web.listen-address={{ wireguard_address }}:9090"
{% else %}
PROMETHEUS_ARGS="--storage.tsdb.retention.time=365d"
PROMETHEUS_ARGS="--storage.tsdb.retention.time=365d --web.enable-remote-write-receiver"
{% endif %}