Logging Architecture

Concept

Logs can be written in several places and then collected, forwarded, and stored. A typical path looks like:

Application
    ↓
stdout / stderr / log file / journald / syslog
    ↓
Local agent (Fluent Bit, rsyslog, Promtail, etc.)
    ↓
Central system (Loki, Elasticsearch, Splunk, cloud logging…)

Why it matters

When someone says “the logs are missing”, you need to know:

  1. Where the application actually writes
  2. Whether a local agent is collecting them
  3. Whether they are being forwarded and retained centrally
  4. Retention and disk limits on each stage

Mental Model

Generation → Local storage / journal → Collection agent → Central store → Retention / search

Each hop can drop, delay, or filter messages.

Common Local Destinations

DestinationTypical use
stdout / stderrContainers (Kubernetes, Docker)
journaldsystemd services
Files under /var/logTraditional applications, rsyslog
Application-specific filesJava, custom apps

Key Investigation Commands

# systemd / journal
journalctl -u <service> -b
journalctl --disk-usage
 
# Classic files
ls -l /var/log
tail -f /var/log/syslog
 
# Container logs
kubectl logs <pod>
docker logs <container>
 
# Disk pressure from logs
du -sh /var/log/*
journalctl --disk-usage

Common Failure Modes & Symptoms

SymptomLikely stageFirst checks
No logs for a serviceGeneration or local collectionIs the app writing? journald/file permissions
Logs stop after some timeDisk full / retention limitsdf, journald config, logrotate
Logs present locally, missing centrallyAgent or networkAgent status, forwarder logs
High disk usage by logsRotation / retention misconfiguredlogrotate, journald SystemMaxUse

Investigation Tips

  • Always establish the full path from application to final storage.
  • In Kubernetes, applications should log to stdout/stderr; node agents collect them.
  • Check both retention settings and disk space — they interact.
  • Timestamps and timezones frequently cause confusion when correlating logs across systems.

Personal Lessons Learned