cleanup and add alloy

This commit is contained in:
Oliver Atkinson
2025-03-11 15:27:16 -06:00
parent cd4854f2c6
commit 265e30ea7d
7 changed files with 48 additions and 22 deletions

15
client/alloy-config.alloy Normal file
View File

@@ -0,0 +1,15 @@
local.file_match "caddy" {
path_targets = [{"__path__" = "/tmp/app-logs/debug.log"}]
sync_period = "5s"
}
loki.write "remote_loki" {
endpoint {
url = "http://10.50.50.x/loki/api/v1/push"
}
}
loki.source.file "local_files" {
targets = local.file_match.caddy.targets
forward_to = [loki.write.local.loki.reciever]
}

20
client/compose.yml Normal file
View File

@@ -0,0 +1,20 @@
services:
# monitor the host
node_exporter:
image: quay.io/prometheus/node-exporter:latest
command:
- '--path.rootfs=/host'
network_mode: host
# uses port 9100
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro'
alloy:
image: grafana/alloy:latest
ports:
- 12345:12345
volumes:
- ./alloy-config.alloy:/etc/alloy/config.alloy
- ./logs:/tmp/app-logs/
command: run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy