Linux journalctl Guide for Developers and DBAs
Use journalctl to inspect Linux service logs, boot logs, time windows and unit failures during application and database incidents. This Formalint reference is written for working developers, DBAs and support engineers who need a repeatable debugging path instead of a one-line snippet with no context.
Use the notes below as a practical review order: understand the input, capture evidence, make one small change and verify the result before moving to the next assumption.
When to use this page
Turn Linux service logs into ordered incident evidence. It is most useful when a small validation or debugging mistake can create noisy tickets, misleading logs or hard-to-review production changes.
Practical workflow
| Step | What to confirm |
|---|---|
| Start with the unit | Read the service that owns the failing behavior first. |
| Narrow time | Use since, until and boot filters to keep output relevant. |
| Escalate severity | Warnings and errors can reveal host-level causes faster than full logs. |
journalctl commands
journalctl -u nginx -n 100 --no-pager
journalctl -u postgresql --since "30 minutes ago" --no-pager
journalctl -p warning..alert --since today --no-pager
journalctl -b -u docker --no-pagerReview checklist
- Record hostname, date and timezone with log extracts.
- Use --no-pager for copyable incident notes.
- Check current boot with -b when a restart occurred.
- Compare service logs with application timestamps.
- Avoid pasting secrets from logs into public tools.
Common mistake
Reading all logs at once feels productive and usually is not. Time-boxed, unit-specific logs are faster.
Formalint is strongest when the page helps the developer decide what the tool cannot prove. Treat every formatter, regex and command as one layer of evidence, not the whole truth.
Frequently asked questions
What does -u mean?
It filters logs to a systemd unit such as nginx, docker or postgresql.
Why do logs disappear after reboot?
Persistent journald storage may not be enabled on every system.
Related Formalint references
Continue with Linux Admin Commands, Linux Cockpit Server Guide, Docker Container Logs Guide.