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

View File

@ -1,12 +0,0 @@
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'

View File

@ -1,20 +1,20 @@
{
admin :2019
servers :80 {
name static_site
metrics
}
servers :3000 {
name grafana
metrics
}
}
:80 {
root * /path/to/html
file_server
servers :3001 {
name loki
metrics
}
log debug {
level debug
output file /var/log/caddy/debug.log
}
}
:3000 {

View File

@ -28,13 +28,16 @@ services:
- caddy
command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
# Logs
loki:
image: grafana/loki:2.9.2
expose:
- 3100
command: -config.file=/etc/loki/local-config.yaml
volumes:
- ./loki.yaml:/etc/loki/local-config.yaml
# log viewer
# Everything viewer
grafana:
image: grafana/grafana:latest
volumes: