User Tools

Site Tools


linux:syslog_debug

Manage journal services

Systemd debug mode

Add the following lines to /etc/systemd/system.conf

LogLevel=debug
LogTarget=syslog-or-kmsg
SysVConsole=yes

Output will be printed to console.

journalctl command

A new service

Show all boot messages:

  # journalctl -b    : Show all messages from this boot
  # journalctl -b -0 : shows messages from the current boot
  # journalctl -b -x : shows messages from the last x boot time

Show all messages from date (and optional time):

  # journalctl --since="2012-10-30 18:17:16"

Show all messages since 20 minutes ago:

  # journalctl --since "20 min ago"
  # journalctl --since 17:10 --until 17:30

Follow new messages (like: tail -f /var/log/messages):

  # journalctl -f

List only the 25 last entries:

  # journalctl -n 

List only errors:

  # journalctl -p err

List detailled:

  # journalctl -o verbose

List whole line:

  # journalctl -o verbose --no-pager

Show all messages by a specific executable:

  # journalctl /usr/lib/systemd/systemd

Filter by command (or _EXE for executable):

  # journalctl --since=today _COMM=sshd

journal persistent

Create a directory to store journal

# mkdir /var/log/journal
# chown root.systemd-journal /var/log/journal
# chmod 2755 /var/log/journal
# killall -USR1 systemd-journal
Or
# systemctl restart systemd-journald

Change journal parameters (default space max used for journal is 10% of the filesystem containing /var/log)

# vi /etc/systemd/journald.conf
[Journal]
...
SystemMaxUse=500M
SystemMaxFileSize=50M
ForwardToSyslog=yes
....
# systemctl restart systemd-journald
linux/syslog_debug.txt · Last modified: 2021/01/01 21:25 (external edit)