The most important journalctl commands fit on a beer mat: journalctl -u nginx shows the logs of one service, -f follows them live, -n 50 gets the last 50 lines, --since "1 hour ago" narrows the time window, -p err filters by severity and -b limits everything to the current boot. That gets you through daily work on any Linux with systemd (Ubuntu, Debian, Fedora, Arch).
What the usual cheat sheets leave out is the small print. On December 5, 2026 we re-tested every command in this article on our own server (systemd 255, just under 1 GB of journal, roughly three million lines from eight days) and in a throwaway container running full systemd. Three results up front:
1.
journalctl -p errreturned zero results for our test service, even though the program had written five error messages and crashed with exit code 3. Everything a service writes to stderr lands in the journal with priority info by default. Even the crash itself is only logged as a warning.2. A service that wrote 300,000 lines in quick succession had only 37,500 of them in the journal afterwards. journald silently dropped the other 262,500. The message “Suppressed 262500 messages” only appeared a minute and a half later, the next time the service ran.
3. The same kind of filter can take 0.01 or 37 seconds.
journalctl -n 50was instant on our server, while a text search with-gacross the whole journal took 22 seconds.
Below you’ll find the command list for quick reference first, then the traps with the numbers behind them.
A full walkthrough by HJFR (October 2026). Good for watching along; the measurements and pitfalls are below.
journalctl commands: the reference list
This table covers an estimated 95 percent of what you’ll ever need on a server. All commands work as root or with sudo. As a regular user you only see part of the journal (more on that below).
| What you want | Command |
|---|---|
| Everything, oldest first | journalctl |
| Last 50 lines | journalctl -n 50 |
Follow live (like tail -f) | journalctl -f |
| Logs of one service | journalctl -u nginx |
| Service live, no old lines | journalctl -u nginx -f -n 0 |
| Several services | journalctl -u nginx -u php8.3-fpm |
| Current boot only | journalctl -b |
| Previous boot | journalctl -b -1 |
| List all boots | journalctl --list-boots |
| Time range | journalctl --since "2026-12-05 08:00" --until "2026-12-05 09:00" |
| Relative time | journalctl --since "1 hour ago" or --since -1h |
| Today / yesterday | journalctl --since today, --since yesterday --until today |
| Errors and worse | journalctl -p err |
| Exactly one priority | journalctl -p warning..warning |
| Search text | journalctl -g "timeout" |
| Kernel messages | journalctl -k |
| By program name | journalctl -t sshd |
| By process ID | journalctl _PID=1234 |
| By user | journalctl _UID=1000 |
| Newest first | journalctl -r |
| No pager (for scripts) | journalctl --no-pager |
| Message only, no header | journalctl -o cat |
| Timestamps with microseconds | journalctl -o short-precise |
| ISO timestamps | journalctl -o short-iso |
| As JSON | journalctl -o json |
| All fields of an entry | journalctl -o verbose |
| Show in UTC | journalctl --utc |
| Explanations for messages | journalctl -xe |
| Disk usage | journalctl --disk-usage |
| Shrink to a size | sudo journalctl --vacuum-size=500M |
| Delete older entries | sudo journalctl --vacuum-time=14d |
| Close the active file | sudo journalctl --rotate |
| Check files for damage | journalctl --verify |
Options combine freely. A typical troubleshooting command looks like this:
sudo journalctl -u my-app -b --since "30 min ago" -p warning --no-pager
Translated: logs of my-app, current boot only, last half hour only, warnings and worse only, printed straight to the terminal.
What is journalctl, anyway?
journalctl is the program you use to read the systemd journal. The journal itself is written by a background service called systemd-journald. It collects everything in one place: kernel messages, the output of every systemd service (stdout and stderr), syslog messages from programs like sshd or cron, and messages programs send directly through the journal API.
The big difference from classic log files like /var/log/syslog: the journal is a structured database, not a text file. Every entry has dozens of fields, such as the service name, process ID, user, priority and a unique boot ID. That’s why journalctl -u nginx can pull out one service’s logs in milliseconds without you digging through text files with grep.
A single entry we wrote with logger had 20 fields in JSON format:
logger -t my-script "jsontest"
journalctl -t my-script -n 1 -o json
Among them MESSAGE, PRIORITY, SYSLOG_IDENTIFIER, _PID, _UID, _BOOT_ID, _HOSTNAME, _TRANSPORT and two timestamps. Fields starting with an underscore are set by journald itself, so the program can’t fake them. That makes the journal more trustworthy for security questions (“which user really triggered this?”) than a plain text line.
The journal is stored in binary form under /var/log/journal/ (persistent) or /run/log/journal/ (in memory only, gone after a reboot). You can’t read the files with cat; that’s what journalctl is for.

Show the logs of a service: journalctl -u
The command you’ll type most often:
sudo journalctl -u nginx # all nginx logs
sudo journalctl -u nginx -n 100 # last 100 lines
sudo journalctl -u nginx -f # follow live
sudo journalctl -u nginx -f -n 0 # live, without the last 10 lines first
sudo journalctl -u nginx -b # since the last boot only
By default -f first shows the last 10 lines and then waits for new ones. Adding -n 0 drops that preamble, which is handy when you want to see exactly what happens on your next click in the browser. Quit with Ctrl + C.
You can leave out the .service suffix. Wildcards work too: journalctl -u 'php*' shows all PHP services at once; in our test -u 'gmde*' correctly found gmdemo.service.
Trap 1: A typo in the service name is not an error
journalctl -u gmdmeo # letters swapped
-- No entries --
echo $?
0
No hint that the service doesn’t exist, and the exit code is 0. In a monitoring script that looks exactly like “no errors, all good”. If you use journalctl in scripts, check first with systemctl cat servicename that the service exists. That command does return an error code on a typo.
Trap 2: The service writes to a file, the journal stays empty
Many unit files redirect output, for example with StandardOutput=append:/var/log/app.log. Then the journal only contains what systemd itself says about the service:
Started gmfile.service.
gmfile.service: Deactivated successfully.
The actual program output lives only in the file. If journalctl -u shows surprisingly little, look at the unit: systemctl cat servicename | grep Standard. How to set up services properly and when a separate log file makes sense is covered in our guide to creating a systemd service. If you work with files, you’ll also need logrotate.
Filter by time: —since and —until
journalctl --since "2026-12-05 08:00:00"
journalctl --since "2026-12-05 08:00" --until "2026-12-05 08:30"
journalctl --since "1 hour ago"
journalctl --since -15m
journalctl --since today
journalctl --since yesterday --until today
Times are interpreted in the server’s local time zone. If your server runs on UTC and you think in your own local time, you can be several hours off. With --utc all timestamps are shown consistently in UTC. What happens to the journal when you change the time zone is something we measured in our article on changing the time zone on Linux: journalctl immediately converts old entries too, rsyslog does not.
Trap 3: Only a fixed set of words is understood
journalctl --since "last week"
Failed to parse timestamp: last week
# exit code 1
journalctl --since "2026-12-05 25:00"
Failed to parse timestamp: 2026-12-05 25:00
Allowed are today, yesterday, tomorrow, now and relative values like "2 hours ago" or -2h. For “last week” write --since "7 days ago" or -7d. At least journalctl fails cleanly here with exit code 1, unlike with a mistyped service name.
Filter by boot: -b and —list-boots
journalctl --list-boots # all stored boots
journalctl -b # current boot
journalctl -b -1 # the one before
journalctl -b -1 -p err # errors during the previous boot
-b -1 is the command for the question “why did the server reboot last night?”. But it only works if the journal is stored persistently and the previous boot hasn’t been cleaned up yet. On our server --list-boots listed exactly one entry: the journal only went back to November 27, because the 1 GB size limit had already deleted everything older. -b -1 then answers:
No journal boot entry found from the specified boot offset (-1).
If you want to investigate crashes after the fact, you need to know how far back your journal reaches. The first entry is in the FIRST ENTRY column of --list-boots.
Filter by priority: -p (and why it often finds nothing)
The journal uses the eight syslog priorities. You can use names or numbers:
| Number | Name | Meaning |
|---|---|---|
| 0 | emerg | System unusable |
| 1 | alert | Act immediately |
| 2 | crit | Critical condition |
| 3 | err | Error |
| 4 | warning | Warning |
| 5 | notice | Normal but significant |
| 6 | info | Informational |
| 7 | debug | Developer details |
-p err shows err and everything worse, so levels 0 to 3. We wrote one message per level with logger and counted: -p err found 4, -p warning 5, -p info 7, -p debug all 8. If you want exactly one level, use a range: -p err..err found exactly 1.

Trap 4: stderr is not an error in the journal
This one surprised us during testing. Our test service was a small Python script that wrote “hello” five times to stdout and “error” five times to stderr, then exited with code 3:
journalctl -u gmdemo -p err
-- No entries --
journalctl -u gmdemo -p warning
gmdemo.service: Failed with result 'exit-code'.
Not a single one of the five error lines. The reason is visible with -o verbose:
PRIORITY=6
_TRANSPORT=stdout
systemd doesn’t distinguish stdout and stderr by priority. Both land in the journal as info (6). And the message about the crash itself is written by systemd with priority 4, a warning, not err. If you’re hunting for crashes, use at least -p warning.
Our real server looks exactly the same: Caddy writes its logs as JSON to stdout, including lines with "level":"error". In the journal they all have PRIORITY=6. journalctl -u caddy -p err finds none of them. For services like that, text search is the better route:
journalctl -u caddy -g '"level":"error"' --since today
If you write the service yourself, you can send the priority along. systemd evaluates a prefix in angle brackets at the start of a line (SyslogLevelPrefix= is on by default):
echo "<3>Database unreachable" # logged as err
echo "<4>Cache almost full" # logged as warning
In our test -p err then found exactly the line with <3>, without the prefix in the output. Python, Node.js and Go also have ready-made libraries (systemd journal handlers) that set the priority directly.
Trap 5: A full disk makes -p err useless
On our server, journalctl -p err returned 364,285 lines over eight days. 364,022 of them came from rsyslogd, all within 100 minutes on November 30: the disk had briefly filled up and rsyslog reported “No space left on device” for every single line. The 167 error messages from sshd and the six from the kernel, the ones that actually matter, drown in that noise.
A quick overview of who’s reporting errors at all saves a lot of scrolling:
journalctl -p err -o export --output-fields=SYSLOG_IDENTIFIER \
| grep '^SYSLOG_IDENTIFIER=' | sort | uniq -c | sort -rn | head
Then filter out the noise, for example with journalctl -p err --since today or specifically with -t sshd. What to do when the disk is full is covered in detail in Linux disk full.
Search text: -g (grep)
journalctl -g "timeout"
journalctl -u nginx -g "upstream.*failed"
journalctl -g "out of memory" -k
-g (long form: --grep) takes PCRE2-style regular expressions. It’s been built in since systemd 237, so you don’t need a | grep afterwards. The advantage over | grep: matches remain real journal entries, so -o json or -o verbose keep working.
Trap 6: One capital letter switches case sensitivity
We wrote two lines, “Out Of Memory UPPER” and “out of memory lower”, and searched:
| Search | Matches |
|---|---|
-g 'out of memory' | 2 |
-g 'Out of memory' | 0 |
-g 'Out of memory' --case-sensitive=false | 2 |
If the pattern is all lowercase, journalctl searches case-insensitively. As soon as there’s a single capital letter, it searches exactly. The kernel message reads “Out of memory: Killed process …”, by the way. Search with that exact spelling and you’ll find it. Accidentally type “Out Of Memory” and you get nothing. When in doubt: write everything in lowercase.
How fast is journalctl? Our measurement
On our server (12 cores, 978 MB journal in 15 files, about 2.96 million lines) we timed the common commands:
| Command | Lines | Duration |
|---|---|---|
journalctl -n 50 | 50 | 0.01 s |
journalctl -u caddy -n 50 | 50 | 0.01 s |
journalctl --since -1h | 2,740 | 0.06 s |
journalctl -u caddy | 91,508 | 1.9 s |
journalctl -u caddy -o json | 91,508 (148.5 MB JSON) | 4.5 s |
journalctl -p err | 364,285 | 4.8 s |
journalctl -g 'Out of memory' | 0 | 22.1 s |
journalctl (everything) | 2,962,879 | 37.6 s |
The rule behind it is simple: anything journalctl can find through an index (the end with -n, a point in time with --since, a field like -u) is fast. Text search with -g has to touch every single message and is slow accordingly. So always narrow down first, then search:
# slow: searches 3 million lines
journalctl -g "connection refused"
# fast: searches only the last hour of one service
journalctl -u caddy --since -1h -g "connection refused"
The JSON output is also worth noting: 91,508 Caddy lines became 148.5 MB, a good 1.6 KB per line, because every field comes along. If you export logs, use --output-fields=MESSAGE,PRIORITY,_SYSTEMD_UNIT to take only the fields you need.
Video by Linux Ninja (August 2026) with a selection of practical commands.
Output formats: -o
| Format | Use it for |
|---|---|
short (default) | Like classic syslog |
short-precise | With microseconds, good for ordering |
short-iso | ISO 8601 with time zone, good for comparing with other logs |
cat | The message only, nothing else |
verbose | All fields of an entry |
json / json-pretty | Machine-readable, one line per entry |
export | Near-binary format for transferring to other machines |
-o cat is ideal when a service already writes its own timestamps (Node.js or Caddy logs, for example) and you don’t need the time twice. -o verbose is the tool when you want to know why a filter doesn’t match: it shows you the real values of PRIORITY, _SYSTEMD_UNIT and _TRANSPORT.
For scripts, --no-pager almost always belongs in the command. Without it, journalctl opens less in a terminal, and a script stuck in less waits forever. In a pipe journalctl detects this on its own, but explicit is safer.
Only new lines since the last run: —cursor-file
For monitoring scripts that, say, check for errors every five minutes, --cursor-file is the least known and most useful feature:
journalctl -t my-script --cursor-file=/var/lib/mycheck/cursor -o cat
On the first run journalctl shows everything and saves its position in the file. On the next run you only get entries added since then. In our test the second call right afterwards showed nothing; after a new logger line it showed exactly that one. No fiddling with timestamps in --since, no duplicated or missed lines. It pairs nicely with a cron job that reports anomalies.
As a regular user: why you see almost nothing
Without root, journalctl in our test only showed the user’s own logs plus a hint:
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
journalctl -u gmdemo returned 0 lines as a regular user, and all 13 after usermod -aG systemd-journal otto and logging in again. For admins who don’t want to type sudo all the time, the systemd-journal group is the clean way. Keep in mind, though: whoever can read the whole journal also reads things like failed SSH logins with usernames and, occasionally, data that programs log carelessly.
journald can drop lines: the rate limit
This is the trap with the biggest consequences, because it’s invisible. journald limits how many lines a single service may write in a short time. The defaults are RateLimitIntervalSec=30s and RateLimitBurst=10000, and journald scales the burst value up depending on free disk space.

Trap 7: 262,500 lines gone, no error message
We had a test service write 300,000 lines as fast as possible:
- 37,500 lines made it into the journal, from “flut 0” to “flut 37499”. Everything after that was missing.
- The service itself reported
Result=success, exit code 0. From its point of view everything went fine. - Right afterwards there was no hint in the journal that anything was missing.
- Only when we started the service again 90 seconds later did this appear:
Suppressed 262500 messages from gmflood2.service.
With 30,000 lines, everything was there. Normal services never hit the limit. But exactly when something goes wrong and a program spits out errors in a loop, you may be missing the decisive lines. Look for such gaps like this:
journalctl -u systemd-journald -g Suppressed
journalctl -g "Suppressed [0-9]+ messages" --since today
If you need everything from a specific service, raise the limit in its unit (not globally):
[Service]
LogRateLimitIntervalSec=0
0 disables the limit for that service. That’s not free, as the next section shows.
Disk usage: how big the journal gets and how to limit it
journalctl --disk-usage
Archived and active journals take up 978.1M in the file system.
Without your own setting, journald takes up to 10 percent of the file system, capped at 4 GB. Our server has SystemMaxUse=1G set, and that’s exactly where the journal sat: 978 MB, 15 files, eight days of history. On a busy server, 1 GB can mean little more than a week.
Set the limit in a separate file so package updates don’t overwrite it:
sudo mkdir -p /etc/systemd/journald.conf.d
sudo tee /etc/systemd/journald.conf.d/size.conf <<'EOF'
[Journal]
SystemMaxUse=1G
MaxRetentionSec=30day
EOF
sudo systemctl restart systemd-journald
Trap 8: One space and the limit doesn’t apply
We deliberately wrote SystemMaxUse=20 MB (with a space). systemctl restart systemd-journald returned exit code 0. Only the journal itself said:
/etc/systemd/journald.conf.d/gm.conf:2: Failed to parse size value, ignoring: 20 MB
journald ignored the line and kept running with the default (in our container “max 4.0G”). The correct form is 20M, 500M or 1G, no space. Check after every change:
journalctl -u systemd-journald -n 5 -o cat
The line “System Journal (…) is X, max Y” tells you which limit journald is actually using.

A limit that’s too small deletes the backstory
We tested the opposite case too: SystemMaxUse=20M, rate limit off, then another flood of 300,000 lines. Result: a 19.3 MB journal in 11 files, and the oldest entry in the entire journal afterwards was “flut 263952”. Everything before that, including the boot messages and our earlier tests, was gone. So with a tight limit, a service running amok can push out exactly the lines that would explain how it got there. Set the limit generously and only relax the rate limit for services where you need every line.
Deleting logs: —vacuum
sudo journalctl --vacuum-size=500M # shrink to 500 MB
sudo journalctl --vacuum-time=14d # everything older than 14 days
sudo journalctl --vacuum-files=5 # keep only the 5 newest archive files
What most guides don’t mention: --vacuum only deletes archived files, never the currently active system.journal. In our container the journal took 56 MB, almost all of it in the active file. --vacuum-size=1M reported “freed 0B”. Only after journalctl --rotate, which closes the active file and starts a new one, were 39.3 MB freed:
sudo journalctl --rotate
sudo journalctl --vacuum-size=1M
After that, our test service’s logs were completely gone too. Vacuum can’t be undone. And please never delete with rm inside /var/log/journal/ while journald is running. By the way, journalctl --verify reported PASS for both remaining files after the vacuum.
Persistent or volatile: Storage=
With the default Storage=auto, journald stores persistently if the directory /var/log/journal exists. If it’s missing, journald only writes to /run/log/journal, i.e. into memory. We renamed the directory in the container and restarted journald: it immediately reported “Runtime Journal (/run/log/journal/…) is 8.0M, max 1.1G”, without a warning. After a reboot everything would have been gone, and journalctl -b -1 would never find anything.
On Ubuntu and Debian the package normally creates the directory; on some minimal images and containers it doesn’t. Check:
ls -d /var/log/journal && journalctl --list-boots | head
If you want guaranteed persistence, set Storage=persistent explicitly in your config file. That creates the directory if needed.
journalctl or /var/log/syslog?
On Ubuntu and Debian, rsyslog often runs alongside journald and writes everything again as text to /var/log/syslog. You then have two copies of the same messages. What speaks for which?
| journalctl | /var/log/syslog | |
|---|---|---|
| Filter by service, boot, priority | built in, fast | only with grep |
| Readable with standard tools | no, binary | yes |
Trusted fields (_UID, _PID) | yes | no |
| Forward to a log server | via systemd-journal-remote | classic syslog |
| Limit size | journald.conf | logrotate |
| Time zone after a change | correct immediately | only after rsyslog restart |
For daily troubleshooting journalctl is clearly more convenient. rsyslog is worth keeping if you send logs to a central syslog server or have tools that expect text files. If you don’t need rsyslog, turning it off saves disk space. On our server, rsyslog wrote 364,022 error lines into the journal when the disk was full, because it couldn’t write to its own file anymore.
Common troubleshooting recipes
Service won’t start:
systemctl status my-app
journalctl -u my-app -b -n 50 --no-pager
What happened last night?
journalctl --since "yesterday 22:00" --until "today 07:00" -p warning
Was a process killed by the OOM killer?
journalctl -k -g "out of memory|killed process" --since -7d
Background on memory: How much RAM does a server need?
Who’s trying to log in via SSH?
journalctl -t sshd -g "invalid user" --since today | wc -l
We had 99 sshd lines in one hour, almost all bots. How to contain that is covered in setting up Fail2ban.
Why did the server reboot?
journalctl --list-boots
journalctl -b -1 -n 100 --no-pager
Which service writes the most?
journalctl --since -1h -o export --output-fields=SYSLOG_IDENTIFIER \
| grep '^SYSLOG_IDENTIFIER=' | sort | uniq -c | sort -rn | head
On our server node led with 1,296 lines in the last hour, ahead of caddy with 565 and CRON with 429.
Checklist for a new server
- Check
ls -d /var/log/journal, otherwise logs are lost on reboot (or setStorage=persistent). - Set a limit in
/etc/systemd/journald.conf.d/, for exampleSystemMaxUse=1G, with no space in the number. - After restarting journald, verify with
journalctl -u systemd-journald -n 5that the limit applies. - Use
journalctl --list-bootsto see how far back the journal actually reaches. - Use at least
-p warningwhen troubleshooting, because crashes land as warning and stderr as info. - Occasionally search for “Suppressed” so dropped lines don’t go unnoticed.
- Add admins to the
systemd-journalgroup instead of usingsudoeverywhere.
We’ve summarized the rest of the basic setup in Linux server setup, and a broader command overview is in our Linux commands list.
FAQ about journalctl commands
How do I show the last 100 lines with journalctl?
With journalctl -n 100, or for a specific service journalctl -u nginx -n 100. It’s instant even on large journals, 0.01 seconds for us.
How do I follow logs live?
journalctl -f for everything, journalctl -u servicename -f for one service. Add -n 0 to see only new lines. Quit with Ctrl + C.
How do I filter journalctl by date and time?
journalctl --since "2026-12-05 08:00" --until "2026-12-05 09:00". Relative values like --since "2 hours ago", --since -2h, today and yesterday work too; free-form phrases like “last week” don’t.
How do I show only errors?
journalctl -p err shows errors and worse. Careful: service output on stderr lands as info by default, and service crashes as warning. For complete troubleshooting -p warning is often better, and for services with their own log format, text search with -g.
How do I clear old logs with journalctl?
With sudo journalctl --vacuum-size=500M or sudo journalctl --vacuum-time=14d. Vacuum only removes archived files. If almost everything is in the active file, run sudo journalctl --rotate first.
Where are journalctl logs stored?
Persistently under /var/log/journal/<machine-id>/, volatile under /run/log/journal/. The files are binary; you can only read them with journalctl.
How do I limit the journal size?
In a file under /etc/systemd/journald.conf.d/ with [Journal] and SystemMaxUse=1G, then systemctl restart systemd-journald. Without a setting journald takes up to 10 percent of the file system, capped at 4 GB.
What is the difference between journalctl and dmesg?
dmesg only reads the kernel ring buffer since the last boot. journalctl -k shows the same kernel messages, but stored persistently and also for earlier boots (journalctl -k -b -1).
Why does journalctl -u show no entries?
Most common reasons: a typo in the service name (journalctl then just says “No entries” with exit code 0), the service writes to its own file via StandardOutput=append:, or you’re not root and not in the systemd-journal group.
How do I export logs to a file?
As text with journalctl -u nginx --since today --no-pager > nginx.txt, as JSON with -o json. With JSON, take only the fields you need via --output-fields=, otherwise the file gets large (1.6 KB per line in our test).
How do I see logs from the previous boot?
With journalctl -b -1. This only works with a persistent journal and if that boot hasn’t been removed by the size limit. journalctl --list-boots shows which boots are still available.
Are log lines lost when a service writes a lot?
Yes. journald drops lines above the rate limit (30-second interval by default, burst from 10,000, more depending on free space). In our test 262,500 of 300,000 lines were missing, and the notice only came on the next run. It can be disabled per service with LogRateLimitIntervalSec=0.
Conclusion: journalctl commands are quick to learn, the gaps are not
Six commands are enough for daily work: -u, -f, -n, --since, -p and -b. If you know them, you’ll find most problems in seconds, as long as you narrow down by service or time first and only then search for text.
The real lesson from our tests is a different one: the journal doesn’t show you everything, and it often doesn’t tell you so. stderr isn’t an error, a crash is only a warning, a wrong service name is “no entries”, a broken size setting is silently ignored, and in a log flood lines go missing without anyone reporting it. Knowing that, you search with -p warning instead of -p err, check journald’s own message after every config change and look for “Suppressed” from time to time. Then journalctl is the best log tool Linux has ever had.
