Prompt
Why are my application logs not showing up in Grafana Loki?
Latest observation
There are a few common reasons application logs don’t appear in Grafana Loki. Here’s a practical checklist to narrow it down quickly:
1) The app isn’t actually writing logs where your agent expects
Common cases:
- Your app logs to stdout/stderr, but your collector is watching a file
- Your app writes to a file, but your collector is reading container logs or a different path
- The log path changed after deployment
Check:
- If using Docker/Kubernetes, confirm whether logs are going to stdout/stderr (
docker logs,kubectl logs) - If using a file tailing agent (Promtail / Grafana Agent / Alloy), verify the exact file path exists on the host/pod
2) Promtail / Grafana Agent / Alloy isn’t scraping the logs
If the log shipper isn’t running, misconfigured, or can’t read the files, nothing reaches Loki.
Check:
- Is the agent running?
- Does it have permissions to read the log files?
- Are the scrape targets discovered?
Useful checks:
- Promtail/Agent logs for errors like:
- “no such file or directory”
- “permission denied”
- “failed to tail”
- “client error 400/401/404”
3) Loki is receiving logs, but labels don’t match your query
This is very common. Logs may be in Loki, but Grafana queries aren’t returning them because you’re filtering on the wrong labels.
Check:
- Query without too many labels first, e.g.
or even broader:{job=~".+"}{} - Look at the labels attached to incoming streams
- Confirm label names like
job,namespace,app,container,pod, etc.
4) Time range in Grafana is wrong
Logs may be present, but not in the selected time window.
Check:
- Expand the time range to something like “Last 24 hours”
- Verify your app’s system clock and the node’s clock are correct
- If logs are delayed, use a wider time window
5) Loki ingestion issues: wrong endpoint, auth, or network
The agent may be failing to send logs to Loki.
Check:
- Loki URL is correct
- TLS/HTTP settings match your deployment
- Authentication headers / tenant ID are set correctly
- Network connectivity exists between shipper and Loki
Common symptoms in shipper logs:
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- connection refused
- x509 certificate errors
- context deadline exceeded
6) Rate limits or ingestion limits in Loki
Loki may reject logs if limits are exceeded.
Check Loki logs/metrics for:
- dropped lines
- rate limit errors
- max line size exceeded
- too many labels / high cardinality issues
Common issues:
- Very large log lines
- Too many unique label combinations
- Bursty ingestion exceeding limits
7) Parsing pipeline is dropping or modifying logs
If you use pipeline stages (regex, JSON parsing, relabeling), they may:
- Drop lines unintentionally
- Fail to parse the format
- Remove labels needed for queries
Check:
- Simplify the pipeline temporarily
- Remove parsing stages and test raw ingestion
- Validate JSON/regex patterns
8) Container/Kubernetes log path mismatch
For Kubernetes, common paths are:
/var/log/pods/.../var/log/containers/*.log
If the agent is configured for the wrong path or doesn’t have host mount access, it won’t see logs.
Check:
- Correct hostPath mounts
- Correct service account / RBAC
- Correct cluster discovery config
9) Logs are being written in a format the shipper can’t decode
Examples:
- Multiline stack traces not configured properly
- CRI vs Docker JSON format mismatch
- Non-UTF8 or binary output
Check:
- Multiline config
- Docker/CRI parser config
- App log format
10) Logs are in Loki, but Grafana datasource or tenant is wrong
If you use multi-tenancy or multiple datasources:
- You may be querying the wrong Loki datasource
- You may be using the wrong
X-Scope-OrgID/ tenant
Check:
- Grafana datasource settings
- Tenant/organization configuration
- Whether logs are stored under a different tenant
Fastest way to troubleshoot
- Check the shipper logs first:
- Promtail / Alloy / Grafana Agent
- Confirm the app is writing logs where expected
- Query Loki broadly in Grafana:
{} - Expand the time range
- Verify labels and tenant settings
If you want, I can help you debug it step by step
Send me:
- your setup type: Docker / Kubernetes / VM
- shipper: Promtail / Grafana Agent / Alloy / Fluent Bit
- a sample config
- one example LogQL query you’re using
- any error messages from the shipper or Loki
And I’ll help pinpoint the exact issue.