阅读 的内容man journalctl
,我发现以下内容:
Storage=
Controls where to store journal data. One of "volatile", "persistent", "auto" and "none". If "volatile", journal log data will be stored only in memory, i.e. below the
/run/log/journal hierarchy (which is created if needed). If "persistent", data will be stored preferably on disk, i.e. below the /var/log/journal hierarchy (which is created
if needed), with a fallback to /run/log/journal (which is created if needed), during early boot and if the disk is not writable. "auto" is similar to "persistent" but the
directory /var/log/journal is not created if needed, so that its existence controls where log data goes. "none" turns off all storage, all log data received will be dropped.
Forwarding to other targets, such as the console, the kernel log buffer, or a syslog socket will still work however. Defaults to "auto".
但是,当尝试less
在那里创建文件时,我得到:
[root@long-misc-p001 logs]# less /run/log/journal/xxxxxx/system.journal
"/run/log/journal/xxxxxx/system.journal" may be a binary file. See it anyway?
我还没有设置该选项persistent
,但如果我继续执行less
它,我会得到一个二进制文件 - 这是预期的吗?
journactl
通常给我文字。
答案1
Systemd 日志数据不以纯文本形式存储。它旨在通过该journalctl
工具进行阅读。如果您愿意,您可以使用来strace
确认确实正在从等地方journalctl
读取文件:/run/log/journal
strace journalctl 2>&1 | grep /run/log/journal/