Prompt
Why are my logs missing after shipping from Kubernetes?
Latest observation
If logs are “missing” after shipping from Kubernetes, it usually means one of these things is happening somewhere in the chain:
Common causes
1) The app isn’t writing to stdout/stderr
Kubernetes logging works best when containers log to standard output/error.
If your app writes to a file inside the container, the log shipper may never see it unless it’s explicitly configured to tail that file.
Check:
kubectl logs <pod>- App config for file logging vs console logging
2) The log agent can’t read the container log files
Most shippers (Fluent Bit, Vector, Filebeat, etc.) read from paths like:
/var/log/containers/*.log/var/log/pods/.../var/lib/docker/containers/...(older setups)
If volume mounts, permissions, or runtime paths are wrong, logs won’t be collected.
Check:
- DaemonSet is running on every node
- HostPath mounts are present
- Agent has permission to read the log files
3) Logs are being dropped by the shipper
The collector may intentionally or unintentionally drop logs due to:
- parser failures
- buffer overflow
- rate limits
- filtering rules
- multiline misconfiguration
- invalid JSON / malformed records
Check shipper logs for messages like:
dropped recordsparse errorbuffer fullretry failedpermission denied
4) Log rotation is happening before collection
Kubernetes rotates container logs. If the shipper is too slow or misconfigured, logs can be rotated away before being shipped.
Check:
- agent latency
- buffer sizes
- rotation settings
- node disk pressure
5) Multiline logs are misconfigured
Stack traces, Java exceptions, and similar multiline logs often get split or dropped if multiline rules are wrong.
Symptoms:
- partial logs
- missing stack traces
- huge single events
- parsing errors
6) Filtering or routing rules are excluding logs
Your pipeline may be excluding logs by:
- namespace
- pod label
- container name
- severity level
- regex filter
- sampling
Check:
- Fluent Bit / Fluentd config
- Vector transforms
- ingest pipeline rules in Elasticsearch/OpenSearch/Loki/Datadog/etc.
7) Backend ingestion is failing
The logs may leave Kubernetes but not arrive in the destination because of:
- auth issues
- index/tenant/stream misconfig
- API limits
- network/firewall problems
- TLS errors
- quota/rate limits
Check destination-side metrics and errors.
8) The pod restarts before logs are persisted locally
If the application crashes or the node dies, logs in container runtime buffers may be lost before they’re shipped.
This is especially likely if:
- the shipper is sidecar-based and dies with the pod
- the node is unstable
- logs are only stored on ephemeral disk
9) Time/clock issues
If timestamps are wrong, logs may appear “missing” because they’re indexed far in the past/future or outside your query window.
Check:
- node time sync (NTP)
- app timestamp format
- timezone handling
10) Query/UI issues
The logs might be present but not visible due to:
- wrong index/stream
- time range filters
- namespace selection
- text search filters
- delayed ingestion
Fast debugging checklist
-
Check raw pod logs
kubectl logs <pod> -c <container> -
Check the log shipper pod logs
kubectl logs -n <logging-namespace> <fluent-bit-pod> -
Verify the agent is on the node
kubectl get pods -o wide -n <logging-namespace> -
Inspect whether logs exist on the node
/var/log/containers//var/log/pods/
-
Look for drops/errors
- buffer full
- parser errors
- permission denied
- backend retry failures
-
Check backend ingestion
- UI/query time range
- auth, quota, and indexing errors
Most likely root cause
In many Kubernetes setups, the most common causes are:
- app logs to a file instead of stdout/stderr
- incorrect hostPath mount or permissions in the log shipper
- parser/multiline misconfiguration
- logs filtered out by pipeline rules
If you want, I can help you troubleshoot this step by step if you tell me:
- which shipper you’re using (Fluent Bit, Vector, Filebeat, etc.)
- where logs are going (Loki, Elasticsearch, Datadog, Splunk, etc.)
- whether
kubectl logsshows the missing logs locally