journalctl: Unterschied zwischen den Versionen

Aus Mikiwiki
Wechseln zu: Navigation, Suche
(Weblinks)
Zeile 59: Zeile 59:
  
 
* https://coreos.com/os/docs/latest/reading-the-system-log.html
 
* https://coreos.com/os/docs/latest/reading-the-system-log.html
 +
* https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl
  
  
 
{{cat|Protokollierung}}
 
{{cat|Protokollierung}}
 
{{cat|Shell-Befehl}}
 
{{cat|Shell-Befehl}}

Version vom 7. November 2020, 23:34 Uhr

Der Shell-Befehl journalctl wird zum Lesen der Logdateien des Daemons systemd verwendet.

Inhaltsverzeichnis

Verwendung

Ansehen aller Logeinträge.

# journalctl
-- Logs begin at Sat 2020-10-24 12:14:51 CEST, end at Sat 2020-11-07 22:17:01 CE
Okt 24 12:14:51 kuhn4 kernel: Linux version 4.19.0-11-amd64 (debian-kernel@lists
Okt 24 12:14:51 kuhn4 kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-11-a
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floa
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE regi
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX regi
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x008: 'MPX boun
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'
Okt 24 12:14:51 kuhn4 kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]: 
...

Ansehen der Logeinträge eines bestimmten Dienstes (hier "apache2").

# journalctl -u apache2.service
-- Logs begin at Sat 2020-10-24 12:14:51 CEST, end at Sat 2020-11-07 22:17:01 CE
Okt 24 12:14:53 kuhn4 systemd[1]: Starting The Apache HTTP Server...
Okt 24 12:14:53 kuhn4 systemd[1]: Started The Apache HTTP Server.
Okt 25 00:00:30 kuhn4 systemd[1]: Reloading The Apache HTTP Server.
Okt 25 00:00:30 kuhn4 systemd[1]: Reloaded The Apache HTTP Server.
Okt 25 03:16:28 kuhn4 systemd[1]: Stopping The Apache HTTP Server...
Okt 25 03:16:28 kuhn4 systemd[1]: apache2.service: Succeeded.
...

Ansehen der Logeinträge seit dem letzten Neustart.

# journalctl --boot
-- Logs begin at Sat 2020-10-24 12:14:51 CEST, end at Sat 2020-11-07 22:17:01 CE
Nov 07 09:11:21 kuhn4 kernel: Linux version 4.19.0-12-amd64 (debian-kernel@lists
Nov 07 09:11:21 kuhn4 kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-12-a
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floa
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE regi
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX regi
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x008: 'MPX boun
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]: 
Nov 07 09:11:21 kuhn4 kernel: x86/fpu: xstate_offset[3]:  832, xstate_sizes[3]: 

Um das Ende aller Logeinträge oder Logeinträge eines bestimmten Dienstes anzusehen.

# journalctl -f
# journalctl -u apache2.service -f

Löschen aller Logeinträge bis auf diejenigen der letzten zwei Tage.

# journalctl --vacuum-time=2d

Löschen aller Logeinträge bis auf die letzten 100 MB.

# journalctl --vacuum-size=100M

Weblinks