Overview
`journalctl -xe` combines the `-x` (extended explanation) and `-e` (jump to end of journal) options of the `journalctl` command. This combination displays the most recent system logs while providing additional explanations for errors or warnings, links to relevant manual pages, and bug reports, greatly aiding the troubleshooting process. It is an essential tool for quickly identifying and analyzing various system events such as boot failures, service crashes, and hardware issues.
Key Features
- Instantly view the latest system logs
- Provides detailed explanations for error and warning messages
- Offers guidance to relevant documentation and links for troubleshooting
- Enables rapid diagnosis and analysis of system events
Key Options
`journalctl -xe` is a combination of specific options for the `journalctl` command. The role of each option is as follows:
Basic Options
Filtering Options (Used with journalctl)
Generated command:
Try combining the commands.
Description:
`journalctl -xe` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Various usage examples of the `journalctl -xe` command.
View Latest Logs with Detailed Explanations
journalctl -xe
Displays the most recent system logs with detailed explanations.
Check Latest Error Logs for a Specific Service
journalctl -xe -u apache2.service
For example, checks the latest logs for `apache2.service` with detailed explanations.
View Detailed Logs from Yesterday to Now
journalctl -xe --since "yesterday"
Displays all system logs from midnight yesterday to the present, with detailed explanations.
View Detailed Logs Since the Last Boot
journalctl -xe -b -1
Displays all logs since the previous boot (`-b -1`) with detailed explanations.
View Detailed Logs Within a Specific Time Range
journalctl -xe --since "2023-01-01 10:00:00" --until "2023-01-01 11:00:00"
Checks logs from 10:00 AM to 11:00 AM on January 1, 2023, with detailed explanations.
Tips & Precautions
`journalctl -xe` is a powerful diagnostic tool, but you can increase efficiency by using a few tips when dealing with large amounts of logs.
Actively Use Log Filtering
Filtering logs by specific time ranges (`--since`, `--until`), specific units (`-u`), specific PIDs (`_PID=`), or specific messages (`-g` or `grep`) allows you to quickly find the information you need. Example: `journalctl -xe -u sshd.service --since "1 hour ago"`
Configure Persistent Journaling
By default, `journalctl` logs may disappear upon reboot. Creating the `/var/log/journal` directory allows `systemd-journald` to persistently store logs in this directory. Command: `sudo mkdir -p /var/log/journal`
Change Output Format
You can view logs in various output formats such as `json`, `short`, or `verbose` using the `-o` option. `journalctl -xe -o json` outputs logs in JSON format, which is convenient for integration with other tools.
Real-time Monitoring
Adding the `-f` option allows for real-time display of new logs as they are added, similar to `tail -f`. Example: `journalctl -xe -f`