Difference between revisions of "Journalctl"
Jump to navigation
Jump to search
(19 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{lowercase}} | ||
<code>journalctl</code> command allows to query the contents of the [[systemd]] journal/[[logs]]. | <code>journalctl</code> command allows to query the contents of the [[systemd]] journal/[[logs]]. | ||
== Configuration == | == Configuration == | ||
− | * <code>[[/etc/systemd/ | + | * <code>[[/etc/systemd/journald.conf]]</code> |
== Basic Commands == | == Basic Commands == | ||
* <code>journalctl</code><ref>https://www.freedesktop.org/software/systemd/man/journalctl.html</ref> or <code>journalctl --[[no-pager]]</code> | * <code>journalctl</code><ref>https://www.freedesktop.org/software/systemd/man/journalctl.html</ref> or <code>journalctl --[[no-pager]]</code> | ||
− | * <code>journalctl -r</code> (reverse order) | + | * <code>[[journalctl -r]]</code> (reverse order) |
* <code>journalctl -k</code>: Show only [[kernel]] messages | * <code>journalctl -k</code>: Show only [[kernel]] messages | ||
− | * <code>journalctl -f</code> (follow) | + | * <code>[[journalctl -f]]</code> (follow) |
* <code>[[journalctl -u]] [[service-name]].service</code> | * <code>[[journalctl -u]] [[service-name]].service</code> | ||
:: <code>-u unit_name</code> | :: <code>-u unit_name</code> | ||
Line 15: | Line 16: | ||
::: <code>journalctl -u [[sshd|ssh]]</code> (See also [[sshd logs]]) | ::: <code>journalctl -u [[sshd|ssh]]</code> (See also [[sshd logs]]) | ||
::: <code>[[journalctl -u docker]]</code> | ::: <code>[[journalctl -u docker]]</code> | ||
+ | ::: <code>[[journalctl -u prometheus]]</code> | ||
+ | ::: <code>journalctl -u UNIT_NAME -n 1 -o verbose</code> | ||
* <code>[[journalctl --verify]]</code> | * <code>[[journalctl --verify]]</code> | ||
− | Disk Usage/Logging: | + | [[journalctl -xn --nopager]] |
+ | |||
+ | [[Disk Usage]]/Logging: | ||
* <code>[[journalctl --disk-usage]]</code> | * <code>[[journalctl --disk-usage]]</code> | ||
* <code>journalctl --vacuum-time=2d</code> | * <code>journalctl --vacuum-time=2d</code> | ||
− | * <code>journalctl --vacuum-size=200M</code><ref>https://askubuntu.com/a/1012913</ref> | + | * <code>[[journalctl --vacuum-size]]=200M</code><ref>https://askubuntu.com/a/1012913</ref> |
**--vacuum-size=BYTES Reduce disk usage below specified size | **--vacuum-size=BYTES Reduce disk usage below specified size | ||
**--vacuum-files=INT Leave only the specified number of journal files | **--vacuum-files=INT Leave only the specified number of journal files | ||
− | **--vacuum-time=TIME Remove journal files older than specified time | + | **[[--vacuum-time]]=TIME Remove journal files older than specified time |
− | * <code>journalctl --list-boots</code>. See also: <code>last (command)</code> | + | * <code>journalctl --list-boots</code>. See also: <code>[[last (command)]]</code> |
* <code>journalctl -xb</code> | * <code>journalctl -xb</code> | ||
:<code>-x --catalog</code> Includes explanations in log lines from [[message catalgog]] | :<code>-x --catalog</code> Includes explanations in log lines from [[message catalgog]] | ||
:<code>-b </code> show message from current [[boot]]. if [ID] is provided will show messages from that specific [[boot]]. | :<code>-b </code> show message from current [[boot]]. if [ID] is provided will show messages from that specific [[boot]]. | ||
+ | |||
+ | |||
+ | * <code>journalctl --since "2 days ago"</code> | ||
+ | |||
+ | == Related terms == | ||
+ | * <code>[[docker run]] -d --[[log-driver]]=[[journald]] YOUR_CONTAINER</code> | ||
+ | * [[rsyslogd]] | ||
+ | * <code>journalctl --identifier=[[ignition]] --all</code> | ||
== Activities == | == Activities == | ||
− | * Review [[ | + | * Review [[journalctl logs]] |
− | |||
==See also== | ==See also== | ||
Line 38: | Line 50: | ||
* {{journalctl}} | * {{journalctl}} | ||
* {{systemd}} | * {{systemd}} | ||
− | |||
* [[launchd]] init and operating system service management daemon for [[MacOS]] | * [[launchd]] init and operating system service management daemon for [[MacOS]] | ||
* {{logging}} | * {{logging}} | ||
Line 48: | Line 59: | ||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Systemd]] | [[Category:Systemd]] | ||
+ | [[Category:journalctl]] |
Latest revision as of 12:05, 28 September 2023
journalctl
command allows to query the contents of the systemd journal/logs.
Configuration[edit]
Basic Commands[edit]
journalctl
[1] orjournalctl --no-pager
journalctl -r
(reverse order)journalctl -k
: Show only kernel messagesjournalctl -f
(follow)journalctl -u service-name.service
-u unit_name
journalctl -u service-name.service -f
journalctl -u libvirtd
journalctl -u ssh
(See also sshd logs)journalctl -u docker
journalctl -u prometheus
journalctl -u UNIT_NAME -n 1 -o verbose
journalctl -xn --nopager
Disk Usage/Logging:
journalctl --disk-usage
journalctl --vacuum-time=2d
journalctl --vacuum-size=200M
[2]- --vacuum-size=BYTES Reduce disk usage below specified size
- --vacuum-files=INT Leave only the specified number of journal files
- --vacuum-time=TIME Remove journal files older than specified time
journalctl --list-boots
. See also:last (command)
journalctl -xb
-x --catalog
Includes explanations in log lines from message catalgog-b
show message from current boot. if [ID] is provided will show messages from that specific boot.
journalctl --since "2 days ago"
Related terms[edit]
docker run -d --log-driver=journald YOUR_CONTAINER
- rsyslogd
journalctl --identifier=ignition --all
Activities[edit]
- Review journalctl logs
See also[edit]
- journald:
journalctl
journald.conf
,journalctl --help
,/dev/console
- systemd-journald:
journalctl
,/etc/systemd/journald.conf
,journalctl logs
,journalctl --list-boots
,journalctl --disk-usage
,journalctl -u kubelet
,journalctl -u prometheus
,journalctl --help
- Systemd:
systemctl
,systemd-journald
,journalctl
systemd-cat
,systemd-logind
,systemd-networkd
:networkctl
,systemd-timesyncd
,systemd-resolved
,systemd-udevd
[3],Systemd-logind: loginctl
,hostnamectl
,udevadm
,systemd-run
,portablectl
,systemd-nspawn
, systemd resource management, Timer (systemd), systemd logs,/etc/systemd/
, systemd services,systemd-mount
,/run/systemd/
,.service
,/usr/lib/systemd/
,/usr/lib/systemd/system/
,/usr/lib/systemd/system/systemd-resolved.service
,/lib/systemd/
, machinectl, systemd-oomd, systemd-analyze - launchd init and operating system service management daemon for MacOS
- Linux logging, Cisco IOS logging
du, du -hs
, Disk space usage,df
,ls
,tree
,find
,docker system df
,journalctl --disk-usage
, No space left on device, ENOSPC,sar -F
,growpart
,resize2fs
, ncdu, duf, dua-cli
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Source: https://en.wikiversity.org/wiki/Linux_Administration/System_Services/System_Logging/Journalctl
Advertising: