-
-
Notifications
You must be signed in to change notification settings - Fork 3
Arch Linux Log Management
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to log management on Arch Linux, including journalctl, log rotation, log analysis, and log maintenance.
Journal files:
# Journal location
/var/log/journal/
# User journal
~/.local/share/journal/Configure journal:
# Edit config
sudo vim /etc/systemd/journald.confSettings:
[Journal]
Storage=persistent
SystemMaxUse=1G
SystemKeepFree=2G
Basic commands:
# All logs
journalctl
# Recent logs
journalctl -n 50
# Follow logs
journalctl -f
# Boot logs
journalctl -bFilter by:
# By service
journalctl -u service-name
# By priority
journalctl -p err
# By time
journalctl --since today
journalctl --since "2024-01-15 10:00:00"Configure rotation:
# Edit config
sudo vim /etc/systemd/journald.confSettings:
SystemMaxUse=1G
SystemKeepFree=2G
MaxRetentionSec=1month
Rotate logs:
# Rotate journal
sudo journalctl --rotate
# Vacuum old logs
sudo journalctl --vacuum-time=2weeks
sudo journalctl --vacuum-size=1GSearch:
# Search text
journalctl | grep error
# Case insensitive
journalctl | grep -i error
# With context
journalctl | grep -A 5 -B 5 errorExport:
# Export to file
journalctl > logs.txt
# Export specific service
journalctl -u service-name > service-logs.txtClean logs:
# Check size
journalctl --disk-usage
# Vacuum
sudo journalctl --vacuum-time=1weekCheck configuration:
# Check journal config
cat /etc/systemd/journald.conf
# Check journal status
systemctl status systemd-journaldThis guide covered systemd journal, journalctl usage, log rotation, log analysis, and troubleshooting.
- Journalctl Troubleshooting - More on journalctl
- Arch Linux System Configuration - System setup
- ArchWiki Log Management: https://wiki.archlinux.org/title/Systemd/Journal
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.