Prompt
How do I fix logs not showing up in Grafana Loki?
Latest observation
When logs aren’t showing up in Grafana Loki, the issue is usually in one of four places:
- The log source isn’t shipping logs
- The shipper can’t reach Loki
- Loki is receiving logs but storing/indexing them incorrectly
- Grafana query/time filters aren’t matching the logs
Here’s a practical checklist to debug it.
1) Confirm logs are actually being generated
First make sure the app/container/host is producing logs locally.
- For containers:
docker logs <container>kubectl logs <pod> -n <namespace>
- For system logs:
journalctl -u <service>- check
/var/log/...
If no logs exist locally, Loki won’t have anything to show.
2) Check your log shipper
Most Loki setups use one of these:
- Promtail
- Grafana Alloy / Agent
- Fluent Bit
- Vector
- Docker logging driver
- Kubernetes DaemonSet
Look for shipper errors
Check shipper logs for:
- connection refused
- TLS/cert errors
- 401/403 auth errors
- 429 rate limits
- parse errors
- permission issues reading log files
Examples:
kubectl logs -n monitoring ds/promtail
docker logs promtail
journalctl -u promtail
3) Verify the shipper is sending to the right Loki URL
A very common issue is a bad push endpoint.
Typical Loki push endpoint:
http://<loki-host>:3100/loki/api/v1/push
Check config for:
- correct host/port
- HTTP vs HTTPS mismatch
- path typo
- wrong namespace/service name in Kubernetes
- proxy/load balancer not forwarding correctly
Example Promtail config snippet:
clients:
- url: http://loki:3100/loki/api/v1/push
4) Check labels and your Grafana query
In Loki, logs are queried by labels first. If labels are wrong or too specific, you may not find anything.
In Grafana Explore, try a broad query:
{job=~".+"}
Or even just:
{}
If that returns nothing, either:
- no data is reaching Loki, or
- retention/time range is off
If it returns logs, then your original label selector is too narrow or incorrect.
Common label mistakes
- Querying
app="myapp"when the actual label isapp_name="myapp" - Using the wrong namespace/pod/container labels
- High-cardinality labels causing unexpected grouping
- Missing
joblabel entirely
5) Check the time range in Grafana
A surprisingly common issue is just the wrong time window.
- Set the range to Last 24 hours or Last 7 days
- Make sure the server clocks are in sync
- Check timezone differences between source and Grafana
- Verify timestamps in logs aren’t far in the past/future
If the shipper reads old log files, Loki may store timestamps that don’t match your expected window.
6) Confirm Loki itself is healthy
Check Loki service health.
Common endpoints:
curl http://<loki-host>:3100/ready
curl http://<loki-host>:3100/metrics
Expected:
/readyshould returnready- metrics should be accessible
- Loki pods/containers should be healthy
In Kubernetes:
kubectl get pods -n monitoring
kubectl describe pod <loki-pod> -n monitoring
kubectl logs <loki-pod> -n monitoring
Look for:
- crash loops
- OOM kills
- compactor/index issues
- object storage errors
- WAL corruption
- ingester not ready
7) Check ingestion limits and rate limits
Loki may be rejecting logs if limits are hit.
Symptoms:
- shipper logs show
429 Too Many Requests - logs silently stop during bursts
Check Loki config for:
ingestion_rate_mbingestion_burst_size_mb- per-stream limits
- label limits
If needed, increase limits carefully.
8) Check storage backend
If Loki uses S3, GCS, Azure, filesystem, or boltdb-shipper, storage problems can block log visibility.
Look for:
- incorrect bucket/container names
- bad credentials
- permission denied
- missing persistent volume
- corrupted index/chunks
- network issues to object storage
9) Verify parsing pipeline stages
If you use Promtail/Alloy pipeline stages, a parsing mistake may drop or mislabel logs.
Examples:
- regex doesn’t match
- JSON stage fails
- multiline config incorrect
dropstage filters too much
Try temporarily simplifying the pipeline to ship raw logs with minimal labels.
10) Check whether logs are being dropped
Search your shipper config for:
dropmatch- relabeling rules
- sampling
- exclude patterns
A rule may be excluding exactly the logs you want.
11) If using Kubernetes, check service discovery
For Kubernetes-based setups, ensure:
- the DaemonSet runs on all nodes
- RBAC allows pod/node discovery
- correct
__path__for container logs /var/log/podsor/var/log/containersis mounted- container runtime path matches your cluster
A wrong file path is one of the most common Kubernetes issues.
12) Test a manual push to Loki
This helps isolate whether Loki is receiving data at all.
curl -X POST http://<loki-host>:3100/loki/api/v1/push \
-H "Content-Type: application/json" \
--data-raw '{
"streams": [
{
"stream": { "job": "test" },
"values": [
["'"$(date +%s%N)"'","hello from curl"]
]
}
]
}'
Then query in Grafana:
{job="test"}
If this works, Loki is fine and the problem is in the shipper/configuration.
13) Use Loki’s own query API to verify data
Try:
curl -G http://<loki-host>:3100/loki/api/v1/query_range \
--data-urlencode 'query={job="test"}' \
--data-urlencode 'limit=10'
This bypasses Grafana and shows whether Loki has the data.
14) Common quick fixes
If you want the fastest likely fixes, check these first:
- Correct Loki push URL
- Grafana time range set wide enough
- Query uses correct labels
- Shipper is running and has file access
- Loki pod/service is healthy
- No auth/TLS mismatch
- No rate limits being hit
- Logs aren’t being filtered/dropped
Example troubleshooting flow
- Generate a known log line
- Confirm it exists locally
- Check shipper logs
- Push a test log manually to Loki
- Query it directly with Loki API
- Query it in Grafana with a wide time range
- Narrow down label/pipeline issues
If you want, I can help more specifically
If you paste any of these, I can diagnose it more precisely:
- your Promtail/Alloy/Fluent Bit config
- Loki config
- Grafana query you’re using
- shipper logs or Loki logs
- Kubernetes vs Docker vs VM setup
If you share the setup, I can walk you through the exact fix.