补充 systemd 配置.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-12-31 17:56:40 +08:00
parent f1d3cbfae8
commit 264463ac37
1 changed files with 24 additions and 0 deletions

View File

@ -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
```