LinuxCommandLibrary

systemctl-log-target

Set systemd log target

TLDR

Show the current log target of the systemd manager

$ systemctl log-target
copy

Set the manager's log target
$ systemctl log-target [journal-or-kmsg|journal|kmsg|console|syslog|null|auto]
copy

SYNOPSIS

systemctl log-target [TARGET]

PARAMETERS

TARGET
    Specifies the desired output target for systemd journal logs. If omitted, the current log target is displayed. Possible values include:
journal: (Default) Directs logs to the systemd journal.
kmsg: Sends logs to the kernel ring buffer, making them visible via dmesg.
console: Sends logs directly to the system console.
syslog: Forwards logs to a traditional syslog daemon (e.g., rsyslog, syslog-ng) via a socket.
null: Discards all log messages, effectively silencing log output.

DESCRIPTION

The systemctl log-target command is used to display or modify the output target for systemd-journald, the systemd logging service. By default, systemd-journald collects and stores log messages in its structured journal.

This subcommand allows administrators to redirect these log messages to various destinations, which can be useful for debugging, integrating with traditional syslog systems, or temporarily silencing log output. When called without any arguments, it shows the current active log target. When provided with a specific target, it instructs systemd-journald to send subsequent log messages to that destination. This change affects the runtime behavior of the logging service and is generally not persistent across reboots unless configured in the systemd-journald.conf file.

CAVEATS

Changes made with systemctl log-target are typically temporary and only apply to the current runtime session. They will not persist across system reboots. To make changes permanent, modify the systemd-journald.conf configuration file.

Setting the log target to null will prevent log messages from being written, which can significantly hinder troubleshooting and system diagnostics. The syslog target requires a compatible syslog daemon to be running and properly configured to receive messages from systemd-journald.

PERSISTENCE

To make log target changes permanent across reboots, you must edit the /etc/systemd/journald.conf file. Look for the Storage and ForwardToSyslog, ForwardToKMsg, ForwardToConsole, ForwardToWall options, or specifically the RuntimeLogTarget option if supported by your systemd version. After modifying the file, you need to restart the systemd-journald service using systemctl restart systemd-journald for the changes to take effect.

PERMISSIONS

Changing the log target using systemctl log-target typically requires root privileges. This is necessary to modify the runtime configuration of the systemd-journald service.

HISTORY

The systemd project, initiated in 2010 by Lennart Poettering and Kay Sievers, aimed to replace the traditional System V init system in Linux distributions. As part of this comprehensive system management suite, systemd-journald was introduced to provide a centralized, structured logging system. The log-target subcommand within systemctl was developed to offer administrators a convenient runtime mechanism to control the output destination of these logs, complementing the static configuration options available in systemd-journald.conf. This functionality became available as systemd matured and was adopted by major Linux distributions like Fedora, openSUSE, and Debian.

SEE ALSO

systemctl(1), journalctl(1), systemd-journald(8), systemd-journald.conf(5)

Copied to clipboard