Skip to content

Commit 39436d4

Browse files
Merge pull request #225 from reef-technologies/alloy
Migrate from promtail to alloy
2 parents 64561d3 + 9711109 commit 39436d4

File tree

4 files changed

+45
-39
lines changed

4 files changed

+45
-39
lines changed

features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
- [Sentry](https://sentry.io) error tracking preconfigured
7171
- Grafana for metrics and log aggregation (Grafana Loki)
7272
- Prometheus for data collection
73-
- Grafana Loki for log aggregation with Promtail for log shipping
73+
- Grafana Loki for log aggregation with Alloy for log shipping
7474
- Generic host dashboard section optimized for both VM and physical machines
7575
- [Integration of framework allowing easy addition of new application-level metrics](https://github.com/reef-technologies/django-business-metrics)
7676
- nginx-level dashboard section for http/ws statistics
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
discovery.docker "containerlogs" {
2+
host = "unix:///var/run/docker.sock"
3+
}
4+
5+
discovery.relabel "containerlogs" {
6+
targets = []
7+
8+
rule {
9+
source_labels = ["__meta_docker_container_name"]
10+
regex = "/(.*)"
11+
target_label = "container"
12+
}
13+
14+
rule {
15+
source_labels = ["__meta_docker_container_log_stream"]
16+
target_label = "logstream"
17+
}
18+
}
19+
20+
loki.source.docker "containerlogs" {
21+
host = "unix:///var/run/docker.sock"
22+
targets = discovery.docker.containerlogs.targets
23+
forward_to = [loki.write.default.receiver]
24+
relabel_rules = discovery.relabel.containerlogs.rules
25+
}
26+
27+
loki.write "default" {
28+
endpoint {
29+
url = sys.env("LOKI_URL") + "/loki/api/v1/push"
30+
31+
basic_auth {
32+
username = sys.env("LOKI_USER")
33+
password = sys.env("LOKI_PASSWORD")
34+
}
35+
}
36+
}

{{cookiecutter.repostory_name}}/envs/prod/docker-compose.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,23 +238,21 @@ services:
238238
{% endif %}
239239

240240
{% if cookiecutter.log_aggregating == 'y' %}
241-
promtail:
242-
image: grafana/promtail:2.9.2
241+
alloy:
242+
image: grafana/alloy:v1.8.3
243243
restart: unless-stopped
244244
environment:
245245
- LOKI_URL=${LOKI_URL}
246-
- LOKI_REFRESH_INTERVAL=${LOKI_REFRESH_INTERVAL}
247246
- LOKI_USER=${LOKI_USER}
248247
- LOKI_PASSWORD=${LOKI_PASSWORD}
249-
- LOKI_CLIENT=${LOKI_CLIENT}
250-
- LOKI_CLIENT_SERVER_GROUP=${LOKI_CLIENT_SERVER_GROUP}
251248
volumes:
252-
- ./promtail:/etc/promtail
249+
- ./alloy:/etc/alloy
253250
- /var/run/docker.sock:/var/run/docker.sock:ro
254-
- promtail-data:/var/lib/promtail
251+
- alloy-data:/var/lib/alloy
255252
command:
256-
- -config.file=/etc/promtail/config.yml
257-
- -config.expand-env=true
253+
- run
254+
- --storage.path=/var/lib/alloy/data
255+
- /etc/alloy/config.alloy
258256
logging:
259257
<<: *logging
260258
{% endif %}
@@ -286,4 +284,4 @@ volumes:
286284
backups:
287285
gunicorn-socket:
288286
nodeexporter_collectors:
289-
promtail-data:
287+
alloy-data:

{{cookiecutter.repostory_name}}/promtail/config.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)