- linux service logs
- Use journalctl to View Your System’s Logs.
journalctlmay be used to query the contents of the systemd journal as written by
- If called without parameters, it will show the full contents of the journal, starting with the oldest entry collected.
- Ubuntu Journalctl Service
Basic Log Viewing
To see the logs that the
journald daemon has collected, use the
-- Logs begin at Tue 2015-02-03 21:48:52 UTC, end at Tue 2015-02-03 22:29:38 UTC. -- Feb 03 21:48:52 localhost.localdomain systemd-journal: Runtime journal is using 6.2M (max allowed 49. .... . . . . .
journalctl displays output in a pager for easier consumption. It will print full log, so you wont have to scroll.You can do this with the
To actively follow the logs as they are being written, you can use the
To Exit this Command
To limit the number of lines that
journalctl returns, use the
-n (lines) option.
journalctl -n 10
Display the TimeStamps in UTC
If you want to display the timestamps in UTC, you can use the
Logs from the Current Boot
The most basic of these which you might use daily, is the
Logs from Yesterday
To get the data from yesterday
journalctl --since yesterday
Here are Some of the Options
--no-full, --full, -l– Ellipsize fields when they do not fit in available columns. The default is to show full fields, allowing them to wrap or be truncated by the pager, if one is used.
-a, --all– Show all fields in full, even if they include unprintable characters or are very long. By default, fields with unprintable characters are abbreviated as “blob data”.
--no-tail– Show all stored output lines, even in follow mode. Undoes the effect of –lines=.
-r, --reverse– Reverse output so that the newest entries are displayed first.
--utc– Express time in Coordinated Universal Time (UTC).
-m, --merge– Show entries interleaved from all available journals, including remote ones.