From 264463ac37d07bb1295c4d84ac120d14de7a90ba Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Thu, 31 Dec 2020 17:56:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=20systemd=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rick.chan --- .../Modules/Systemd/Systemd_基本控制命令.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Software/System/Linux/Modules/Systemd/Systemd_基本控制命令.md b/Software/System/Linux/Modules/Systemd/Systemd_基本控制命令.md index d5a1390..a91471f 100644 --- a/Software/System/Linux/Modules/Systemd/Systemd_基本控制命令.md +++ b/Software/System/Linux/Modules/Systemd/Systemd_基本控制命令.md @@ -135,3 +135,27 @@ systemd-analyze [OPTIONS...] timespan SPAN... # 如果没指定任何命令,那么等价于使用 systemd-analyze time 命令。 systemd-analyze [OPTIONS...] security UNIT... ``` + +## 4.配置 + +journal 的配置在 /etc/systemd/journald.conf 中,主要配置项如下: + +```ini +# /etc/systemd/journald.conf + +# Storage: 在哪里存储日志文件: "volatile" 表示仅保存在内存中, 也就是仅保存在 /run/log/journal 目录中(将会被自动按需创建)。 "persistent" 表示优先保存在磁盘上, 也就优先保存在 /var/log/journal 目录中(将会被自动按需创建), 但若失败(例如在系统启动早期"/var"尚未挂载), 则转而保存在 /run/log/journal 目录中(将会被自动按需创建)。 "auto"(默认值) 与 "persistent" 类似, 但不自动创建 /var/log/journal 目录, 因此可以根据该目录的存在与否决定日志的保存位置。 "none" 表示不保存任何日志(直接丢弃所有收集到的日志), 但日志转发(见下文)不受影响。 默认值是 "auto" +Storage=auto +``` + +system 和 user 的配置在 /etc/systemd/system.conf 和 /etc/systemd/user.conf 中,主要配置项如下: + +```ini +# /etc/systemd/system.conf +# /etc/systemd/user.conf + +# LogLevel: Set log level. As argument this accepts a numerical log level or the well-known syslog(3) symbolic names (lowercase): emerg, alert, crit, err, warning, notice, info, debug. +LogLevel=info + +# LogTarget: Set log target. Argument must be one of console, journal, kmsg, journal-or-kmsg, null. +LogTarget=journal-or-kmsg +```