Most common symptoms after a Loki (de)activation or Caddy log format change:
1. “NO DATA” on the Caddy dashboard despite incoming requests.
Check the ingestion chain end-to-end:
# On the Caddy host: is Alloy running? reading files?
sudo systemctl status alloy --no-pager
sudo journalctl -u alloy -n 100 --no-pager | grep -iE 'error|permission'
ls -la /var/log/caddy/access-*.log # must be caddy:caddy
# On the monitoring host itself, or from the tailnet: is Loki receiving?
# (replace <IP> with the monitoring host's internal IP, Loki does NOT
# bind on 127.0.0.1 — see http_listen_address = bindAddr. From a plain
# LAN client the connection is refused, by design.)
curl -s http://<IP>:3100/loki/api/v1/labels | jq
curl -sG http://<IP>:3100/loki/api/v1/query \
--data-urlencode 'query={job="caddy"}' | jq '.data.result | length'
An empty reply on /loki/api/v1/* while /ready answers 200 is the
frontend advertising the wrong address (see common.instance_addr);
journalctl -u loki | grep frontend= names it. Restart Loki after a fix.
2. alloy.service: mkdir data-alloy/remotecfg: permission denied.
Orphaned ownership of /var/lib/alloy inherited from a former DynamicUser.
The service ExecStartPre normally fixes it, but if stuck (e.g. unit in
start-limit-hit):
sudo systemctl stop alloy
sudo chown -R caddy:caddy /var/lib/alloy
sudo systemctl reset-failed alloy
sudo systemctl start alloy
3. Grafana refuses to start: Datasource provisioning error: data source not found. UID conflict in SQLite DB after provision change
(typically switching from auto-generated UID to uid = "loki").
The deleteDatasources option handles this in theory; otherwise manual
purge:
sudo systemctl stop grafana
sudo sqlite3 /var/lib/grafana/grafana.db \
"DELETE FROM data_source WHERE name='Loki';"
sudo systemctl reset-failed grafana
sudo systemctl start grafana
4. Stale Caddy log files (old naming with : or schema, e.g.
access-http:__nextcloud.log). Harmless but pollute Alloy tail output.
Clean up after a migration:
sudo rm /var/log/caddy/access-{http,https}:__*.log
sudo rm /var/log/caddy/access-:*.log # variants `:80`, `:443`
sudo systemctl reload caddy # optional