Contents
- Start with a question, not a list of everything
- Time window, time zone and boot
- Unit of Service is more accurate than random text grep
- Structured arrays and their logical joining
- Priorities help guide you, but they are not a complete description of severity.
- Live tracking and maintaining readable range
- What does missing history mean?
- How to deliver a useful result
- Frequently asked questions
Start with a question, not a list of everything
The Journal collects events from various services and the kernel. Without a filter, thousands of lines can hide the one you need. First, determine the question: why the service did not start, what preceded the restart, when the process terminated, or what happened with a specific request. Add the time and the right machine to that.
Journalctl is a reading interface to available journal files, but some of its options can also manage and delete history. This article focuses on reading. The vacuum or rotation options are not part of the incident search. If you need to explain the past, do not delete its available evidence beforehand.
The scope of the output depends on permissions, retention, namespace, and collection configuration. An empty filter is not automatically proof of a non-existent event. Verify the correctness of the view by, for example, finding a known service control start or your own test login. Only then does it make sense to draw a conclusion from what is missing in the selected period.
Time window, time zone and boot
For the incident, distinguish between local time, UTC, and the time specified by the application. Use an unambiguous format and write down the time zone used. The journal can contain multiple boots; the default query and the -b filter do not mean the same thing. If the server has restarted in the meantime, you need to verify whether the history of the previous run is preserved at all.
date -Is
sudo journalctl --list-boots
sudo journalctl -b --since "-30 min" -o short-iso --no-pager
sudo journalctl -b -1 -n 100 -o short-iso --no-pagerRelative time -30 min is practical during the current diagnostics, but does not describe the same section later. Therefore, include the actual start and end times in the transmitted record. For an exact interval, you can specify --since and --until with a specific date. When using --utc, verify the meaning of the input times according to the available version and choose an explicit zone where there would be ambiguity.
When changing the system clock, the sequence within the boot may also be important. The output of short-monotonic will help you read the time relative to its beginning. However, do not compare monotonic values from different machines or boots as a common absolute clock. Each of these time views addresses a different question.
Unit of Service is more accurate than random text grep
If you know the systemd unit, start with its filter. It includes the relevant operational context and makes it easier to distinguish from a similarly named program. Find the unit name from the actual system; SSH can be ssh.service or sshd.service, and PHP-FPM has the version in the name. Don't guess it from another server.
systemctl status APLIKACE.service --no-pager
sudo journalctl -u APLIKACE.service --since "-1 hour" \
-o short-iso --no-pager
# Související dvě služby v jednom časově seřazeném pohledu:
sudo journalctl -u nginx.service -u php8.3-fpm.service \
--since "-30 min" -o short-iso --no-pagerReplace APPLICATION and version with the actual. Listing multiple units can help with starting dependencies or reloading. A time match does not prove causation, but it does allow you to track the sequence. For an application's own file log, the journal may not contain all the details, so if necessary, include this source in the same period.
For a kernel error, use -k. This is not the same as searching for the word kernel in an application message. Similarly, for user services, use --user and the corresponding user context. The root system view itself may not be the same as a regular user's query into their private journal.
Structured arrays and their logical joining
The journal may contain fields such as _SYSTEMD_UNIT, _PID, _BOOT_ID, and SYSLOG_IDENTIFIER. Their meanings vary; fields with a leading underscore have different trust properties than any message text. For single event details, use verbose or JSON and read the actual fields. Don't assume that every event has everything filled in.
sudo journalctl -u APLIKACE.service -n 3 -o verbose --no-pager
sudo journalctl -u APLIKACE.service -n 3 -o json-pretty --no-pager
# Příklad cíleného výběru pole:
sudo journalctl SYSLOG_IDENTIFIER=sshd --since "-1 hour" --no-pagerDifferent fields in a single direct query are typically combined as conditions at the same time. Multiple values of the same field are considered as alternatives. The single + character allows you to separate alternative groups. Therefore, filtering _PID and _SYSTEMD_UNIT does not automatically mean "show one or the other". Verify the logic especially for the query whose empty result you want to pass off as evidence.
The PID itself is not a permanent identity. Also use boot and time, as the number can be reassigned. SYSLOG_IDENTIFIER may not match the service name and may change between versions of the program. So if you recently migrated OpenSSH or a container, compare the actual fields, not just the old saved filter.
Priorities help guide you, but they are not a complete description of severity.
The priority filter can quickly select more serious entries. However, an application may send an important event as information and, conversely, report a routine problem with high priority. Therefore, supplement the first pass with -p with the surrounding context without such a narrow restriction. Otherwise, you may only see the consequence, for example an unsuccessful reboot, but miss the cause before it.
sudo journalctl -b -p warning --since "-1 hour" --no-pager
sudo journalctl -u APLIKACE.service -n 100 --no-pagerThe -p warning option by definition includes the appropriate severity range, not automatically just the exact word warning. Check your local manual for numeric and text levels. Also, consider the significance of the event in relation to your operation: one restart of a batch job may be expected, while a lost backup is significant even without a dramatic error message.
Follow the first relevant deviation in the chain. Repeated Failed to start is often the result of a configuration error, missing file, limit, or dependency a few lines earlier. Increasing StartLimit or constantly retrying the start will not fix this cause on its own.
Live tracking and maintaining readable range
For a limited reproducible test, open a trace on one unit and perform a safe operation on the other terminal. This will give the output a clear relationship to the test. Note what you triggered so you don't confuse the diagnostic request with the original problem later. In production, avoid endlessly repeating an expensive scenario.
sudo journalctl -f -u APLIKACE.service -n 30 -o short-iso
# Sledování ukončíte Ctrl-C; tím neukončujete sledovanou službu.For scripting or submission, use --no-pager and an explicit line limit or time window. Without them, the output may contain a large and disjointed amount of data. For automated processing, prefer structured JSON and a corresponding parser instead of splitting human text by spaces. Multi-line messages and time formats would easily break such naive processing.
A too narrow string filter can also miss related messages with different wording. If you are looking for a specific error, use the text as a starting point for your search and then read a wider section of the same service. The conclusion must match the entire sequence, not just a single regular expression match.
What does missing history mean?
Check permissions, boot, namespace and storage method. The journal may only be in memory space and may not have older data after a restart. Retention may delete files and some services write outside the journal. Also, the logging frequency limit may mean that some similar events have been suppressed. Therefore, do not automatically consider the available information as a complete sum of all events.
sudo journalctl --disk-usage
sudo journalctl --list-boots
systemctl status systemd-journald.service --no-pagerThese checks do not create missing logs retroactively. If you need better auditing going forward, design persistent or remote storage, adequate retention, and functional checks. This is a separate change with capacity and access implications. It is not appropriate to secretly attach it to a one-time read diagnostic and then claim that it already contains a past event.
How to deliver a useful result
Choose a minimal meaningful time frame including context. Write down the server, drive, boot, time zone, exact query, and what you learned from it. Separate the confirmed event from the likely explanation. If any source is missing, state the limitations and another specific question that needs to be verified.
- The time period corresponds to the incident and its scope is clear.
- The service and fields used are validated on a real system.
- Events are read with context and are not mistaken for a complete audit of activity.
- The transmitted view does not contain secret values and unrelated personal or operational data.
- The diagnostics did not change the service or remove the necessary history.
In CH-J Tools, you can use a terminal and open related checks side by side. However, the client itself does not change what the server collects. Good journal analysis is reproducible: another administrator, based on the entered time and filter, finds the same event and understands what conclusions can be safely drawn from the available evidence.
Frequently asked questions
Is journalctl just for errors?
No. It displays different priorities and types of system and application events depending on what is written to the journal.
Why can't I see yesterday's boot?
The history may have been volatile, unrotated, or outside your permissions. Verify --list-boots and the actual retention configuration.
Does an empty filter mean there was no event?
Not automatically. It could be a faulty unit, identifier, time, boot or the collection itself.
Does Ctrl-C with journalctl -f kill the service?
No. It will terminate this reading process of the watch, not the service being watched itself.
Detailed documentation
systemd: the complete journalctl guide →