Zum Inhalt springen

Journalctl: Unterschied zwischen den Versionen

Aus Foxwiki
K Textersetzung - „ z. B. “ durch „ beispielsweise “
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 15: Zeile 15:
=== Optionen ===
=== Optionen ===
; Source Options
; Source Options
    --system               Show the system journal
  --system       Show the system journal
    --user                 Show the user journal for the current user
  --user         Show the user journal for the current user
  -M --machine=CONTAINER     Operate on local container
  -M --machine=CONTAINER   Operate on local container
  -m --merge                 Show entries from all available journals
  -m --merge         Show entries from all available journals
  -D --directory=PATH       Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
  -D --directory=PATH   Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
  -i --file=PATH             Show journal file
  -i --file=PATH       Show journal file
    --root=PATH             Operate on an alternate filesystem root
  --root=PATH       Operate on an alternate filesystem root
    --image=PATH           Operate on disk image as filesystem root
  --image=PATH     Operate on disk image as filesystem root
    --image-policy=POLICY   Specify disk image dissection policy
  --image-policy=POLICY Specify disk image dissection policy
    --namespace=NAMESPACE   Show journal data from specified journal namespace
  --namespace=NAMESPACE Show journal data from specified journal namespace


; Filtering Options
; Filtering Options
  -S --since=DATE           Show entries not older than the specified date
  -S --since=DATE     Show entries not older than the specified date
  -U --until=DATE           Show entries not newer than the specified date
  -U --until=DATE     Show entries not newer than the specified date
  -c --cursor=CURSOR         Show entries starting at the specified cursor
  -c --cursor=CURSOR     Show entries starting at the specified cursor
    --after-cursor=CURSOR   Show entries after the specified cursor
  --after-cursor=CURSOR Show entries after the specified cursor
    --cursor-file=FILE     Show entries after cursor in FILE and update FILE
  --cursor-file=FILE   Show entries after cursor in FILE and update FILE
  -b --boot[=ID]             Show current boot or the specified boot
  -b --boot[=ID]       Show current boot or the specified boot
  -u --unit=UNIT             Show logs from the specified unit
  -u --unit=UNIT       Show logs from the specified unit
    --user-unit=UNIT       Show logs from the specified user unit
  --user-unit=UNIT   Show logs from the specified user unit
    --invocation=ID         Show logs from the matching invocation ID
  --invocation=ID     Show logs from the matching invocation ID
  -I                         Show logs from the latest invocation of unit
  -I             Show logs from the latest invocation of unit
  -t --identifier=STRING     Show entries with the specified syslog identifier
  -t --identifier=STRING   Show entries with the specified syslog identifier
  -T --exclude-identifier=STRING
  -T --exclude-identifier=STRING
  Hide entries with the specified syslog identifier
  Hide entries with the specified syslog identifier
  -p --priority=RANGE       Show entries within the specified priority range
  -p --priority=RANGE   Show entries within the specified priority range
    --facility=FACILITY... Show entries with the specified facilities
  --facility=FACILITY... Show entries with the specified facilities
  -g --grep=PATTERN         Show entries with MESSAGE matching PATTERN
  -g --grep=PATTERN     Show entries with MESSAGE matching PATTERN
    --case-sensitive[=BOOL] Force case sensitive or insensitive matching
  --case-sensitive[=BOOL] Force case sensitive or insensitive matching
  -k --dmesg                 Show kernel message log from the current boot
  -k --dmesg         Show kernel message log from the current boot


; Output Control Options
; Output Control Options
  -o --output=STRING         Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
  -o --output=STRING     Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
    --output-fields=LIST   Select fields to print in verbose/export/json modes
  --output-fields=LIST Select fields to print in verbose/export/json modes
  -n --lines[=[+]INTEGER]   Number of journal entries to show
  -n --lines[=[+]INTEGER] Number of journal entries to show
  -r --reverse               Show the newest entries first
  -r --reverse       Show the newest entries first
    --show-cursor           Print the cursor after all the entries
  --show-cursor     Print the cursor after all the entries
    --utc                   Express time in Coordinated Universal Time (UTC)
  --utc         Express time in Coordinated Universal Time (UTC)
  -x --catalog               Add message explanations where available
  -x --catalog       Add message explanations where available
  -W --no-hostname           Suppress output of hostname field
  -W --no-hostname     Suppress output of hostname field
    --no-full               Ellipsize fields
  --no-full       Ellipsize fields
  -a --all                   Show all fields, including long and unprintable
  -a --all         Show all fields, including long and unprintable
  -f --follow               Follow the journal
  -f --follow       Follow the journal
    --no-tail               Show all lines, even in follow mode
  --no-tail       Show all lines, even in follow mode
    --truncate-newline     Truncate entries by first newline character
  --truncate-newline   Truncate entries by first newline character
  -q --quiet                 Do not show info messages and privilege warning
  -q --quiet         Do not show info messages and privilege warning
    --synchronize-on-exit=BOOL
  --synchronize-on-exit=BOOL
                            Wait for Journal synchronization before exiting
              Wait for Journal synchronization before exiting


; Pager Control Options
; Pager Control Options
    --no-pager             Do not pipe output into a pager
  --no-pager       Do not pipe output into a pager
  -e --pager-end             Immediately jump to the end in the pager
  -e --pager-end       Immediately jump to the end in the pager


; Forward Secure Sealing (FSS) Options
; Forward Secure Sealing (FSS) Options
    --interval=TIME         Time interval for changing the FSS sealing key
  --interval=TIME     Time interval for changing the FSS sealing key
    --verify-key=KEY       Specify FSS verification key
  --verify-key=KEY   Specify FSS verification key
    --force                 Override of the FSS key pair with --setup-keys
  --force         Override of the FSS key pair with --setup-keys


; Commands
; Commands
  -h --help                 Show this help text
  -h --help         Show this help text
    --version               Show package version
  --version       Show package version
  -N --fields               List all field names currently used
  -N --fields       List all field names currently used
  -F --field=FIELD           List all values that a specified field takes
  -F --field=FIELD     List all values that a specified field takes
    --list-boots           Show terse information about recorded boots
  --list-boots     Show terse information about recorded boots
    --list-invocations     Show invocation IDs of specified unit
  --list-invocations   Show invocation IDs of specified unit
    --list-namespaces       Show list of journal namespaces
  --list-namespaces   Show list of journal namespaces
    --disk-usage           Show total disk usage of all journal files
  --disk-usage     Show total disk usage of all journal files
    --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
    --verify               Verify journal file consistency
  --verify       Verify journal file consistency
    --sync                 Synchronize unwritten journal messages to disk
  --sync         Synchronize unwritten journal messages to disk
    --relinquish-var       Stop logging to disk, log to temporary file system
  --relinquish-var   Stop logging to disk, log to temporary file system
    --smart-relinquish-var Similar, but NOP if log directory is on root mount
  --smart-relinquish-var Similar, but NOP if log directory is on root mount
    --flush                 Flush all journal data from /run into /var
  --flush         Flush all journal data from /run into /var
    --rotate               Request immediate rotation of the journal files
  --rotate       Request immediate rotation of the journal files
    --header               Show journal header information
  --header       Show journal header information
    --list-catalog         Show all message IDs in the catalog
  --list-catalog     Show all message IDs in the catalog
    --dump-catalog         Show entries in the message catalog
  --dump-catalog     Show entries in the message catalog
    --update-catalog       Update the message catalog database
  --update-catalog   Update the message catalog database
    --setup-keys           Generate a new FSS key pair
  --setup-keys     Generate a new FSS key pair


See the journalctl(1) man page for details
See the journalctl(1) man page for details
Zeile 112: Zeile 112:
| 0 || Erfolg
| 0 || Erfolg
|-
|-
| >0 || Fehler
| >0 || Fehler
|}
|}


Zeile 248: Zeile 248:
==== Kritikalität ====
==== Kritikalität ====
; Filtern nach Kritikalität
; Filtern nach Kritikalität
Sie können journalctl nach Kritikalität filtern, indem Sie die Option -p mit einer Prioritätsstufe verwenden, wie z. B. err für Fehler, crit für kritisch oder alert für Alarm. Diese Option zeigt nur Einträge mit der angegebenen Priorität oder höher an. Die Prioritäten reichen von 0: emerg bis 7: debug, wobei niedrigere Nummern eine höhere Kritikalität bedeuten.  
Sie können journalctl nach Kritikalität filtern, indem Sie die Option -p mit einer Prioritätsstufe verwenden, wie beispielsweise err für Fehler, crit für kritisch oder alert für Alarm. Diese Option zeigt nur Einträge mit der angegebenen Priorität oder höher an. Die Prioritäten reichen von 0: emerg bis 7: debug, wobei niedrigere Nummern eine höhere Kritikalität bedeuten.  


; Fehler und höher anzeigen
; Fehler und höher anzeigen
Zeile 260: Zeile 260:


; Prioritätsstufen (von kritisch zu unwichtig):
; Prioritätsstufen (von kritisch zu unwichtig):
    emerg   (0: Notfall)
  emerg (0: Notfall)
    alert   (1: Alarm)
  alert (1: Alarm)
    crit   (2: kritisch)
  crit (2: kritisch)
    err     (3: Fehler)
  err   (3: Fehler)
    warning (4: Warnung)
  warning (4: Warnung)
    notice (5: Hinweis)
  notice (5: Hinweis)
    info   (6: Information)
  info (6: Information)
    debug   (7: Fehlersuche)
  debug (7: Fehlersuche)


=== Fehlersuche ===
=== Fehlersuche ===
Zeile 283: Zeile 283:
  Active: failed (Result: exit-code) since Tue 2014-06-03 11:08:13 CEST; 7min ago
  Active: failed (Result: exit-code) since Tue 2014-06-03 11:08:13 CEST; 7min ago
  Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND \
  Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND \
  -k graceful-stop (code=exited, status=1/FAILURE)* Die ID des Prozesses, der den Fehler verursacht, lautet 11026
  -k graceful-stop (code=exited, status=1/FAILURE)* Die ID des Prozesses, der den Fehler verursacht, lautet 11026


Rufen Sie die ausführliche Version der Meldungen zur Prozess-ID 11026 ab
Rufen Sie die ausführliche Version der Meldungen zur Prozess-ID 11026 ab
Zeile 296: Zeile 296:
  Active: active (running) since Tue 2014-06-03 11:26:24 CEST; 4ms ago
  Active: active (running) since Tue 2014-06-03 11:26:24 CEST; 4ms ago
  Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND
  Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND
  -k graceful-stop (code=exited, status=1/FAILURE)
  -k graceful-stop (code=exited, status=1/FAILURE)
  Main PID: 11263 (httpd2-prefork)
  Main PID: 11263 (httpd2-prefork)
  Status: "Processing requests..."
  Status: "Processing requests..."
  CGroup: /system.slice/apache2.service
  CGroup: /system.slice/apache2.service
  ├─11263 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11263 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11280 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11280 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11281 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11281 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11282 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11282 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11283 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  ├─11283 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  └─11285 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
  └─11285 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]


== Anhang ==
== Anhang ==
Zeile 336: Zeile 336:
=== Optionen ===
=== Optionen ===
; Source Options
; Source Options
    --system               Show the system journal
  --system       Show the system journal
    --user                 Show the user journal for the current user
  --user         Show the user journal for the current user
  -M --machine=CONTAINER     Operate on local container
  -M --machine=CONTAINER   Operate on local container
  -m --merge                 Show entries from all available journals
  -m --merge         Show entries from all available journals
  -D --directory=PATH       Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
  -D --directory=PATH   Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
  -i --file=PATH             Show journal file
  -i --file=PATH       Show journal file
    --root=PATH             Operate on an alternate filesystem root
  --root=PATH       Operate on an alternate filesystem root
    --image=PATH           Operate on disk image as filesystem root
  --image=PATH     Operate on disk image as filesystem root
    --image-policy=POLICY   Specify disk image dissection policy
  --image-policy=POLICY Specify disk image dissection policy
    --namespace=NAMESPACE   Show journal data from specified journal namespace
  --namespace=NAMESPACE Show journal data from specified journal namespace


; Filtering Options
; Filtering Options
  -S --since=DATE           Show entries not older than the specified date
  -S --since=DATE     Show entries not older than the specified date
  -U --until=DATE           Show entries not newer than the specified date
  -U --until=DATE     Show entries not newer than the specified date
  -c --cursor=CURSOR         Show entries starting at the specified cursor
  -c --cursor=CURSOR     Show entries starting at the specified cursor
    --after-cursor=CURSOR   Show entries after the specified cursor
  --after-cursor=CURSOR Show entries after the specified cursor
    --cursor-file=FILE     Show entries after cursor in FILE and update FILE
  --cursor-file=FILE   Show entries after cursor in FILE and update FILE
  -b --boot[=ID]             Show current boot or the specified boot
  -b --boot[=ID]       Show current boot or the specified boot
  -u --unit=UNIT             Show logs from the specified unit
  -u --unit=UNIT       Show logs from the specified unit
    --user-unit=UNIT       Show logs from the specified user unit
  --user-unit=UNIT   Show logs from the specified user unit
    --invocation=ID         Show logs from the matching invocation ID
  --invocation=ID     Show logs from the matching invocation ID
  -I                         Show logs from the latest invocation of unit
  -I             Show logs from the latest invocation of unit
  -t --identifier=STRING     Show entries with the specified syslog identifier
  -t --identifier=STRING   Show entries with the specified syslog identifier
  -T --exclude-identifier=STRING
  -T --exclude-identifier=STRING
  Hide entries with the specified syslog identifier
  Hide entries with the specified syslog identifier
  -p --priority=RANGE       Show entries within the specified priority range
  -p --priority=RANGE   Show entries within the specified priority range
    --facility=FACILITY... Show entries with the specified facilities
  --facility=FACILITY... Show entries with the specified facilities
  -g --grep=PATTERN         Show entries with MESSAGE matching PATTERN
  -g --grep=PATTERN     Show entries with MESSAGE matching PATTERN
    --case-sensitive[=BOOL] Force case sensitive or insensitive matching
  --case-sensitive[=BOOL] Force case sensitive or insensitive matching
  -k --dmesg                 Show kernel message log from the current boot
  -k --dmesg         Show kernel message log from the current boot


; Output Control Options
; Output Control Options
  -o --output=STRING         Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
  -o --output=STRING     Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
    --output-fields=LIST   Select fields to print in verbose/export/json modes
  --output-fields=LIST Select fields to print in verbose/export/json modes
  -n --lines[=[+]INTEGER]   Number of journal entries to show
  -n --lines[=[+]INTEGER] Number of journal entries to show
  -r --reverse               Show the newest entries first
  -r --reverse       Show the newest entries first
    --show-cursor           Print the cursor after all the entries
  --show-cursor     Print the cursor after all the entries
    --utc                   Express time in Coordinated Universal Time (UTC)
  --utc         Express time in Coordinated Universal Time (UTC)
  -x --catalog               Add message explanations where available
  -x --catalog       Add message explanations where available
  -W --no-hostname           Suppress output of hostname field
  -W --no-hostname     Suppress output of hostname field
    --no-full               Ellipsize fields
  --no-full       Ellipsize fields
  -a --all                   Show all fields, including long and unprintable
  -a --all         Show all fields, including long and unprintable
  -f --follow               Follow the journal
  -f --follow       Follow the journal
    --no-tail               Show all lines, even in follow mode
  --no-tail       Show all lines, even in follow mode
    --truncate-newline     Truncate entries by first newline character
  --truncate-newline   Truncate entries by first newline character
  -q --quiet                 Do not show info messages and privilege warning
  -q --quiet         Do not show info messages and privilege warning
    --synchronize-on-exit=BOOL
  --synchronize-on-exit=BOOL
                            Wait for Journal synchronization before exiting
              Wait for Journal synchronization before exiting


; Pager Control Options
; Pager Control Options
    --no-pager             Do not pipe output into a pager
  --no-pager       Do not pipe output into a pager
  -e --pager-end             Immediately jump to the end in the pager
  -e --pager-end       Immediately jump to the end in the pager


; Forward Secure Sealing (FSS) Options
; Forward Secure Sealing (FSS) Options
    --interval=TIME         Time interval for changing the FSS sealing key
  --interval=TIME     Time interval for changing the FSS sealing key
    --verify-key=KEY       Specify FSS verification key
  --verify-key=KEY   Specify FSS verification key
    --force                 Override of the FSS key pair with --setup-keys
  --force         Override of the FSS key pair with --setup-keys


; Commands
; Commands
  -h --help                 Show this help text
  -h --help         Show this help text
    --version               Show package version
  --version       Show package version
  -N --fields               List all field names currently used
  -N --fields       List all field names currently used
  -F --field=FIELD           List all values that a specified field takes
  -F --field=FIELD     List all values that a specified field takes
    --list-boots           Show terse information about recorded boots
  --list-boots     Show terse information about recorded boots
    --list-invocations     Show invocation IDs of specified unit
  --list-invocations   Show invocation IDs of specified unit
    --list-namespaces       Show list of journal namespaces
  --list-namespaces   Show list of journal namespaces
    --disk-usage           Show total disk usage of all journal files
  --disk-usage     Show total disk usage of all journal files
    --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
    --verify               Verify journal file consistency
  --verify       Verify journal file consistency
    --sync                 Synchronize unwritten journal messages to disk
  --sync         Synchronize unwritten journal messages to disk
    --relinquish-var       Stop logging to disk, log to temporary file system
  --relinquish-var   Stop logging to disk, log to temporary file system
    --smart-relinquish-var Similar, but NOP if log directory is on root mount
  --smart-relinquish-var Similar, but NOP if log directory is on root mount
    --flush                 Flush all journal data from /run into /var
  --flush         Flush all journal data from /run into /var
    --rotate               Request immediate rotation of the journal files
  --rotate       Request immediate rotation of the journal files
    --header               Show journal header information
  --header       Show journal header information
    --list-catalog         Show all message IDs in the catalog
  --list-catalog     Show all message IDs in the catalog
    --dump-catalog         Show entries in the message catalog
  --dump-catalog     Show entries in the message catalog
    --update-catalog       Update the message catalog database
  --update-catalog   Update the message catalog database
    --setup-keys           Generate a new FSS key pair
  --setup-keys     Generate a new FSS key pair


See the journalctl(1) man page for details
See the journalctl(1) man page for details

Aktuelle Version vom 16. Juni 2026, 09:24 Uhr

journalctl - Abfragen des Systemd-Journals

Beschreibung

Abfrage von Inhalten des Journals von Systemd wie von Journald geschrieben

Installation

Aufruf

journalctl [OPTIONS...] [MATCHES...]

Optionen

Source Options
 --system        Show the system journal
 --user         Show the user journal for the current user
-M --machine=CONTAINER   Operate on local container
-m --merge         Show entries from all available journals
-D --directory=PATH    Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
-i --file=PATH       Show journal file
 --root=PATH       Operate on an alternate filesystem root
 --image=PATH      Operate on disk image as filesystem root
 --image-policy=POLICY  Specify disk image dissection policy
 --namespace=NAMESPACE  Show journal data from specified journal namespace
Filtering Options
-S --since=DATE      Show entries not older than the specified date
-U --until=DATE      Show entries not newer than the specified date
-c --cursor=CURSOR     Show entries starting at the specified cursor
 --after-cursor=CURSOR  Show entries after the specified cursor
 --cursor-file=FILE   Show entries after cursor in FILE and update FILE
-b --boot[=ID]       Show current boot or the specified boot
-u --unit=UNIT       Show logs from the specified unit
 --user-unit=UNIT    Show logs from the specified user unit
 --invocation=ID     Show logs from the matching invocation ID
-I             Show logs from the latest invocation of unit
-t --identifier=STRING   Show entries with the specified syslog identifier
-T --exclude-identifier=STRING
Hide entries with the specified syslog identifier
-p --priority=RANGE    Show entries within the specified priority range
 --facility=FACILITY... Show entries with the specified facilities
-g --grep=PATTERN     Show entries with MESSAGE matching PATTERN
 --case-sensitive[=BOOL] Force case sensitive or insensitive matching
-k --dmesg         Show kernel message log from the current boot
Output Control Options
-o --output=STRING     Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
 --output-fields=LIST  Select fields to print in verbose/export/json modes
-n --lines[=[+]INTEGER]  Number of journal entries to show
-r --reverse        Show the newest entries first
 --show-cursor      Print the cursor after all the entries
 --utc          Express time in Coordinated Universal Time (UTC)
-x --catalog        Add message explanations where available
-W --no-hostname      Suppress output of hostname field
 --no-full        Ellipsize fields
-a --all          Show all fields, including long and unprintable
-f --follow        Follow the journal
 --no-tail        Show all lines, even in follow mode
 --truncate-newline   Truncate entries by first newline character
-q --quiet         Do not show info messages and privilege warning
 --synchronize-on-exit=BOOL
             Wait for Journal synchronization before exiting
Pager Control Options
 --no-pager       Do not pipe output into a pager
-e --pager-end       Immediately jump to the end in the pager
Forward Secure Sealing (FSS) Options
 --interval=TIME     Time interval for changing the FSS sealing key
 --verify-key=KEY    Specify FSS verification key
 --force         Override of the FSS key pair with --setup-keys
Commands
-h --help         Show this help text
 --version        Show package version
-N --fields        List all field names currently used
-F --field=FIELD      List all values that a specified field takes
 --list-boots      Show terse information about recorded boots
 --list-invocations   Show invocation IDs of specified unit
 --list-namespaces    Show list of journal namespaces
 --disk-usage      Show total disk usage of all journal files
 --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
 --verify        Verify journal file consistency
 --sync         Synchronize unwritten journal messages to disk
 --relinquish-var    Stop logging to disk, log to temporary file system
 --smart-relinquish-var Similar, but NOP if log directory is on root mount
 --flush         Flush all journal data from /run into /var
 --rotate        Request immediate rotation of the journal files
 --header        Show journal header information
 --list-catalog     Show all message IDs in the catalog
 --dump-catalog     Show entries in the message catalog
 --update-catalog    Update the message catalog database
 --setup-keys      Generate a new FSS key pair

See the journalctl(1) man page for details

Meldungen ein bestimmtes Programm

Sollen alle Journaleinträge für eine bestimmte ausführbare Datei angezeigt werden, geben Sie den vollständigen Pfad zu dieser Datei an

journalctl /usr/lib/systemd/systemd

Parameter

Umgebungsvariablen

Exit-Status

Wert Beschreibung
0 Erfolg
>0 Fehler

Anwendung

Rufen Sie beispielsweise journalctl ohne weitere Parameter auf, bekommen Sie einen interaktiven Auszug aller Log-Dateien, so wie sie früher in /var/log/syslog oder /var/log/messages landeten

  • Hier können Sie auch durch Eingabe eines großen »F« in den Follow-Modus wechseln
  • Mit dem Parameter -f oder --follow wird Ihnen das Log analog zu einem tail -f angezeigt
  • Wenn Sie die letzten 20 Log-Einträge anschauen wollen, benutzen Sie -n 20 oder --lines=20
  • Der Parameter --reverse zeigt die Einträge in umgekehrter Reihenfolge an

Einträge eines bestimmten Zeitraums grenzen Sie durch --since und --until ein

  • Dabei wird ein Datum in der Form "2018-07-30 18:17:16" ausgewertet
  • Ohne Datum wird der heutige Tag angenommen, ohne Sekunden wird 0 (null) angenommen, Sonderausdrücke wie yesterday, today, tomorrow oder now sind möglich

Einer der wichtigsten Parameter ist -u oder --unit=, womit nur die Log-Dateien einer einzelnen Unit oder eines Satzes an Units ausgegeben werden

Log-Auszug des SSH-Daemons

Log-Einträge des SSH-Daemons vom 5. Juni 2023 zwischen 13:00 Uhr und 14:00 Uhr

sudo journalctl --since="2023-06-05 13:00" --until="2023-06-05 14:00" --unit=sshd.service
-- Logs begin at Mo 2023-06-05 07:19:24 CEST, end at Mo 2023-06-05 15:56:51 CEST. --
Jun 05 13:07:24 centos sshd[13128]: reverse mapping checking getaddrinfo for \
1-2-3-4.a.b [1.2.3.4] failed - POSSIBLE BREAK-IN ATTEMPT!
Jun 05 13:07:24 centos sshd[13130]: reverse mapping checking getaddrinfo for \
1-2-3-4.a.b [1.2.3.4] failed - POSSIBLE BREAK-IN ATTEMPT!
Jun 05 13:07:24 centos sshd[13128]: Connection closed by 1.2.3.4 [preauth]
Jun 05 13:07:24 centos sshd[13130]: Connection closed by 1.2.3.4 [preauth]

Die Logs von journald werden nach einem Neustart gelöscht

  • Wenn Sie das nicht wollen, sollten Sie das Verzeichnis /var/log/journal anlegen und das Signal SIGUSR1 an den journald-Prozess senden
  • Damit werden die Logs in dem angegebenen Verzeichnis persistiert, sodass sie maximal zehn Prozent der Größe des Dateisystems belegen
  • Weitere Konfigurationen nehmen Sie in der Datei /etc/systemd/journald.conf vor

Filtern

Filtern der Journalausgabe

Wenn Sie journalctl ohne Schalter aufrufen, wird der gesamte Inhalt des Journals angezeigt (die ältesten Einträge an erster Stelle)

  • Die Ausgabe kann mit bestimmten Schaltern und Feldern gefiltert werden

Bootnummer

Filtern nach Bootnummer

journalctl kann die Meldungen nach einem bestimmten System-Bootvorgang filtern

  • Zum Anzeigen einer Liste mit allen verfügbaren Bootvorgängen führen Sie Folgendes aus
journalctl --list-boots -1 
0 97ed2cd99124a2391d2cffab1b566f0 Mon 2014-05-26 08:36:56 EDT—Fri 2014-05-30 05:33:44 EDT
1 56019a44a774a0bb0148a92df4af81b Fri 2014-05-30 05:34:09 EDT—Fri 2014-05-30 06:15:01 EDT
  • Die erste Spalte enthält den Boot-Offset: 0 für den aktuellen Bootvorgang, -1 für den vorangegangenen Bootvorgang, -2 für den davor erfolgten Bootvorgang usw
  • Die zweite Spalte zeigt die Boot-ID, gefolgt von den Zeitstempeln für Beginn und Ende des Zeitraums, über den das System nach dem Bootvorgang aktiv war
Alle Meldungen für den aktuellen Bootvorgang anzeigen
journalctl -b

Wenn Sie die Journalmeldungen für den vorangegangenen Bootvorgang abrufen möchten, hängen Sie einen Offset-Parameter an

Im folgenden Beispiel werden die Meldungen für den vorangegangenen Bootvorgang ausgegeben

journalctl -b -1

Alternativ können Sie die Bootmeldungen nach der Boot-ID auflisten

Verwenden Sie hierzu das Feld _BOOT_ID

journalctl _BOOT_ID=156019a44a774a0bb0148a92df4af81b

Zeitraum

Filtern nach Zeitraum

Ausgabe von journalctl durch Angabe des Start- oder Enddatums filtern

  • Für Datumsangaben gilt das Format „2014-06-30 9:17:16“
  • Wenn Sie keine Uhrzeit angeben, wird Mitternacht (0:00 Uhr) angenommen
  • Wenn die Sekundenangabe fehlt, wird „:00“ angenommen
  • Wenn Sie kein Datum angeben, wird das aktuelle Datum angenommen
  • Statt eines numerischen Ausdrucks können Sie die Schlüsselwörter „gestern“, „heute“ oder „morgen“ angeben
  • Diese Wörter bezeichnen Mitternacht am Tag vor dem aktuellen Tag, am aktuellen Tag bzw
  • am Tag nach dem aktuellen Tag
  • Das Schlüsselwort „now“ (jetzt) verweist auf die aktuelle Uhrzeit am heutigen Tag
  • Auch relative Zeitangaben mit dem Präfix - oder + sind möglich
  • Diese Zeitangaben verweisen dann entsprechend auf eine Uhrzeit vor oder nach der aktuellen Uhrzeit
Nur neue Meldungen

Nur neue Meldungen ab jetzt anzeigen und Ausgabe entsprechend aktualisieren

journalctl --since "now" -f
Meldungen seit ...

Alle Meldungen ab der letzten Mitternacht bis 3:20 Uhr anzeigen

journalctl --since "today" --until "3:20"

Felder

Filtern nach Feldern

Sie können die Ausgabe des Journals nach bestimmten Feldern filtern

  • Die Syntax für ein abzugleichendes Feld lautet FELDNAME=FILTERKRITERIUM, beispielsweise _SYSTEMD_UNIT=httpd.service
  • Wenn Sie mehrere Filterkriterien in einer einzigen Abfrage angeben, werden die Ausgabemeldungen noch stärker gefiltert
  • Eine Liste der Standardfelder finden Sie auf der man-Seite man 7 systemd.journal-fields
Meldungen anzeigen, die von einer bestimmten Prozess-ID erzeugt wurden
journalctl _PID=1039
Meldungen anzeigen, die zu einer bestimmten Benutzer-ID gehören
journalctl _UID=1000
Meldungen aus dem Kernel-Ring-Puffer anzeigen (entspricht der Ausgabe von dmesg)
journalctl _TRANSPORT=kernel
Meldungen aus der Standard- oder Fehlerausgabe des Services anzeigen
journalctl _TRANSPORT=stdout
Nur Meldungen anzeigen, die von einem bestimmten Service erzeugt wurden
journalctl _SYSTEMD_UNIT=avahi-daemon.service
Wenn Sie zwei verschiedene Felder angeben, werden nur solche Einträge zurückgegeben, die beide Ausdrücke gleichzeitig erfüllen
journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1488
Wenn Sie zwei Kriterien für dasselbe Feld angeben, werden alle Einträge zurückgegeben, die einen dieser Ausdrücke erfüllen
journalctl _SYSTEMD_UNIT=avahi-daemon.service _SYSTEMD_UNIT=dbus.service
Mit dem Begrenzungszeichen „+“ verbinden Sie zwei Ausdrücke mit einem logischen „OR“
  • Im folgenden Beispiel werden alle Meldungen aus dem Avahi-Service mit der Prozess-ID 1480 zusammen mit allen Meldungen vom D-Bus-Service gezeigt
journalctl _SYSTEMD_UNIT=avahi-daemon.service _PID=1480 + _SYSTEMD_UNIT=dbus.service

Kritikalität

Filtern nach Kritikalität

Sie können journalctl nach Kritikalität filtern, indem Sie die Option -p mit einer Prioritätsstufe verwenden, wie beispielsweise err für Fehler, crit für kritisch oder alert für Alarm. Diese Option zeigt nur Einträge mit der angegebenen Priorität oder höher an. Die Prioritäten reichen von 0: emerg bis 7: debug, wobei niedrigere Nummern eine höhere Kritikalität bedeuten.

Fehler und höher anzeigen
journalctl -p err
Nur kritische Nachrichten anzeigen (und höher)
journalctl -p crit
Alle Meldungen ab „error“ im aktuellen Boot-Vorgang anzeigen
journalctl -p err -b
Prioritätsstufen (von kritisch zu unwichtig)
 emerg  (0: Notfall)
 alert  (1: Alarm)
 crit  (2: kritisch)
 err   (3: Fehler)
 warning (4: Warnung)
 notice (5: Hinweis)
 info  (6: Information)
 debug  (7: Fehlersuche)

Fehlersuche

In diesem Abschnitt wird an einem einfachen Beispiel erläutert, wie Sie die Fehler auffinden und beheben, die systemd beim Starten von apache2 meldet

Versuchen Sie, den apache2-Service zu starten

systemctl start apache2
Job for apache2.service failed
See 'systemctl status apache2' and 'journalctl -xn' for details

Prüfen Sie den Status dieses Service

systemctl status apache2 apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled)
Active: failed (Result: exit-code) since Tue 2014-06-03 11:08:13 CEST; 7min ago
Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND \
 -k graceful-stop (code=exited, status=1/FAILURE)* Die ID des Prozesses, der den Fehler verursacht, lautet 11026

Rufen Sie die ausführliche Version der Meldungen zur Prozess-ID 11026 ab

journalctl -o verbose _PID=11026
[...] MESSAGE=AH00526: Syntax error on line 6 of /etc/apache2/default-server.conf
[...] MESSAGE=Invalid command 'DocumenttRoot', perhaps misspelled or defined by a module [...]

Korrigieren Sie den Schreibfehler in /etc/apache2/default-server.conf, starten Sie den apache2-Service, und lassen Sie den Status ausgeben

systemctl start apache2 && systemctl status apache2 apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled)
Active: active (running) since Tue 2014-06-03 11:26:24 CEST; 4ms ago
Process: 11026 ExecStop=/usr/sbin/start_apache2 -D SYSTEMD -DFOREGROUND
 -k graceful-stop (code=exited, status=1/FAILURE)
Main PID: 11263 (httpd2-prefork)
Status: "Processing requests..."
CGroup: /system.slice/apache2.service
 ├─11263 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
 ├─11280 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
 ├─11281 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
 ├─11282 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
 ├─11283 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]
 └─11285 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf -D [...]

Anhang

Siehe auch



Dokumentation

Man-Page
  1. journalctl(1)

Projekt

  1. https://documentation.suse.com/de-de/sles/12-SP5/html/SLES-all/cha-journalctl.html


Optionen

Source Options
 --system        Show the system journal
 --user         Show the user journal for the current user
-M --machine=CONTAINER   Operate on local container
-m --merge         Show entries from all available journals
-D --directory=PATH    Show journal files from directory (journalctl --directory /media/md2/var/log/journal)
-i --file=PATH       Show journal file
 --root=PATH       Operate on an alternate filesystem root
 --image=PATH      Operate on disk image as filesystem root
 --image-policy=POLICY  Specify disk image dissection policy
 --namespace=NAMESPACE  Show journal data from specified journal namespace
Filtering Options
-S --since=DATE      Show entries not older than the specified date
-U --until=DATE      Show entries not newer than the specified date
-c --cursor=CURSOR     Show entries starting at the specified cursor
 --after-cursor=CURSOR  Show entries after the specified cursor
 --cursor-file=FILE   Show entries after cursor in FILE and update FILE
-b --boot[=ID]       Show current boot or the specified boot
-u --unit=UNIT       Show logs from the specified unit
 --user-unit=UNIT    Show logs from the specified user unit
 --invocation=ID     Show logs from the matching invocation ID
-I             Show logs from the latest invocation of unit
-t --identifier=STRING   Show entries with the specified syslog identifier
-T --exclude-identifier=STRING
Hide entries with the specified syslog identifier
-p --priority=RANGE    Show entries within the specified priority range
 --facility=FACILITY... Show entries with the specified facilities
-g --grep=PATTERN     Show entries with MESSAGE matching PATTERN
 --case-sensitive[=BOOL] Force case sensitive or insensitive matching
-k --dmesg         Show kernel message log from the current boot
Output Control Options
-o --output=STRING     Change journal output mode (short, short-precise, short-iso, short-iso-precise, short-full, short-monotonic, short-unix, verbose, export, json, json-pretty, json-sse, json-seq, cat, with-unit)
 --output-fields=LIST  Select fields to print in verbose/export/json modes
-n --lines[=[+]INTEGER]  Number of journal entries to show
-r --reverse        Show the newest entries first
 --show-cursor      Print the cursor after all the entries
 --utc          Express time in Coordinated Universal Time (UTC)
-x --catalog        Add message explanations where available
-W --no-hostname      Suppress output of hostname field
 --no-full        Ellipsize fields
-a --all          Show all fields, including long and unprintable
-f --follow        Follow the journal
 --no-tail        Show all lines, even in follow mode
 --truncate-newline   Truncate entries by first newline character
-q --quiet         Do not show info messages and privilege warning
 --synchronize-on-exit=BOOL
             Wait for Journal synchronization before exiting
Pager Control Options
 --no-pager       Do not pipe output into a pager
-e --pager-end       Immediately jump to the end in the pager
Forward Secure Sealing (FSS) Options
 --interval=TIME     Time interval for changing the FSS sealing key
 --verify-key=KEY    Specify FSS verification key
 --force         Override of the FSS key pair with --setup-keys
Commands
-h --help         Show this help text
 --version        Show package version
-N --fields        List all field names currently used
-F --field=FIELD      List all values that a specified field takes
 --list-boots      Show terse information about recorded boots
 --list-invocations   Show invocation IDs of specified unit
 --list-namespaces    Show list of journal namespaces
 --disk-usage      Show total disk usage of all journal files
 --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
 --verify        Verify journal file consistency
 --sync         Synchronize unwritten journal messages to disk
 --relinquish-var    Stop logging to disk, log to temporary file system
 --smart-relinquish-var Similar, but NOP if log directory is on root mount
 --flush         Flush all journal data from /run into /var
 --rotate        Request immediate rotation of the journal files
 --header        Show journal header information
 --list-catalog     Show all message IDs in the catalog
 --dump-catalog     Show entries in the message catalog
 --update-catalog    Update the message catalog database
 --setup-keys      Generate a new FSS key pair

See the journalctl(1) man page for details

Meldungen ein bestimmtes Programm

Sollen alle Journaleinträge für eine bestimmte ausführbare Datei angezeigt werden, geben Sie den vollständigen Pfad zu dieser Datei an

journalctl /usr/lib/systemd/systemd