← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Linux Log Files

Linux Intermediate
debt(d7/e3/b5/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints list logrotate, datadog, and prometheus-node-exporter — none of these catch missing logrotate config at write time; disk-fill is only visible via monitoring alerts or when the disk actually fills. A missing postrotate signal continues silently writing to renamed files in production, invisible until log data is lost or disk fills.

e3 Effort Remediation debt — work required to fix once spotted

Closest to 'simple parameterised fix (replace pattern with safer alternative)' (e3). The quick_fix describes configuring logrotate for application log files — this is a small, targeted config file change per application, not a single-line patch but not a multi-file refactor. Each misconfigured log path needs its own logrotate stanza and possibly a postrotate signal, making it a modest parameterised fix across a handful of config files.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). The applies_to covers both web and cli contexts, meaning any PHP application or service needs explicit log rotation config. Forgetting it on any new application or log path restarts the problem. Every deployment, new service, or new log file path requires the developer to remember the rotation concern — a persistent but not system-defining tax.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap (contradicts how a similar concept works elsewhere)' (t7). The misconception explicitly states that developers assume application logs are automatically rotated — this is the canonical wrong belief. Developers familiar with managed platforms (Heroku, cloud logging services) or with system logs that happen to have rotation pre-configured will confidently assume the same applies to their PHP error logs and nginx access logs, leading to silent unbounded growth and eventual server crashes.

About DEBT scoring →

Also Known As

syslog journald logrotate journalctl /var/log

TL;DR

Log locations, rotation, and analysis tools on Linux — /var/log/ structure, journald, logrotate, and essential log analysis commands.

Explanation

Key log locations: /var/log/syslog or /var/log/messages (system events), /var/log/auth.log (authentication), /var/log/nginx/ (web server), /var/log/php/ (PHP errors), /var/log/mysql/ (database). journald stores logs in binary format — use journalctl to query. logrotate manages log rotation: compresses old logs, deletes aged logs, and signals services to reopen log files. Essential commands: tail -f (live follow), grep -i error, awk for field extraction, zcat/zgrep for compressed rotated logs.

Common Misconception

Application logs are automatically rotated — logrotate must be explicitly configured per application; PHP error logs and nginx access logs grow unboundedly without rotation config.

Why It Matters

A server with no log rotation fills its disk with logs, causing all applications to crash — and without log visibility, diagnosing incidents is impossible.

Common Mistakes

  • PHP error_log pointing to a file without logrotate config — grows to gigabytes over months.
  • Not configuring postrotate in logrotate to signal PHP-FPM to reopen logs — continues writing to the renamed file.
  • Grepping uncompressed current log instead of all rotated logs — misses historical events.
  • Not knowing journalctl --since 'yesterday' for time-filtered system logs.

Code Examples

✗ Vulnerable
# No logrotate for PHP app — log grows unbounded:
; php.ini:
error_log = /var/log/php/app.log
; 6 months later: app.log = 47GB
; Server disk: 100% full
; All services crash
✓ Fixed
# /etc/logrotate.d/php-app:
/var/log/php/app.log {
    daily
    rotate 14         # Keep 14 days
    compress          # gzip old logs
    delaycompress     # Keep yesterday uncompressed for tail
    missingok
    notifempty
    create 0640 www-data adm
    postrotate
        # Signal PHP-FPM to reopen log file:
        /bin/kill -USR1 $(cat /run/php-fpm.pid 2>/dev/null) 2>/dev/null || true
    endscript
}

# Query recent errors:
journalctl -u php-fpm --since '1 hour ago' | grep -i error
grep -r 'Fatal error' /var/log/php/

Added 16 Mar 2026
Edited 22 Mar 2026
Views 57
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 1 ping T 0 pings F 0 pings S 1 ping S 4 pings M 1 ping T 1 ping W 1 ping T 1 ping F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 9 Scrapy 6 SEMrush 5 Ahrefs 4 Perplexity 4 Google 4 Unknown AI 4 Claude 2 ChatGPT 2 Bing 1 Meta AI 1 Majestic 1 Common Crawl 1
crawler 39 crawler_json 4 pre-tracking 1
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Low
⚡ Quick Fix
Configure logrotate for all PHP application log files — without rotation, logs fill the disk and cause PHP to stop logging silently or crash the server
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
PHP error log without logrotate config; large application log files consuming disk; no disk space alerts before log fills disk
Auto-detectable: ✓ Yes logrotate datadog prometheus-node-exporter
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: Medium Context: File
CWE-312 CWE-532


✓ schema.org compliant