php*_*_qq 73 log systemd systemd-journald
当我发出时,journalctl
我会得到所有系统服务的大量日志,但所有这些信息都存储在哪里?
mur*_*uru 53
FILES
/etc/systemd/journald.conf
Configure systemd-journald behavior. See journald.conf(5).
/run/log/journal/machine-id/*.journal,
/run/log/journal/machine-id/*.journal~,
/var/log/journal/machine-id/*.journal,
/var/log/journal/machine-id/*.journal~
systemd-journald writes entries to files in
/run/log/journal/machine-id/ or /var/log/journal/machine-id/ with
the ".journal" suffix. If the daemon is stopped uncleanly, or if
the files are found to be corrupted, they are renamed using the
".journal~" suffix, and systemd-journald starts writing to a new
file. /run is used when /var/log/journal is not available, or when
Storage=volatile is set in the journald.conf(5) configuration file.
Run Code Online (Sandbox Code Playgroud)
正如man journalctl
所说:
journalctl may be used to query the contents of the systemd(1) journal
as written by systemd-journald.service(8).
Run Code Online (Sandbox Code Playgroud)
这些日志由systemd-journald
服务管理,因此更合适的术语是“journald
日志”。
sol*_*iCe 19
但是请注意,默认情况下,Ubuntu 不使用持久日志文件。只有 volatile/run/log/journal/<machine-id>/*.journal[~]
会保留到下次启动。每次重新启动都会丢失所有内容。
您可能会看到日志中保留的引导列表:
journalctl --list-boot
Run Code Online (Sandbox Code Playgroud)
日志仍然保存在一个文本文件中,/var/log
除非您通过创建/var/log/journal
目录激活了持久日志日志的使用。
通常存储目录是/var/log/journal
或/run/log/journal
,但它不一定存在于您的系统中。
如果您只想检查日志当前在磁盘上占用的空间量,只需键入:
$ journalctl --disk-usage
Run Code Online (Sandbox Code Playgroud)
存储目录取决于 journald 配置。
配置文件是:
/etc/systemd/journald.conf
/etc/systemd/journald.conf.d/*.conf
/run/systemd/journald.conf.d/*.conf
/usr/lib/systemd/journald.conf.d/*.conf
Run Code Online (Sandbox Code Playgroud)
“ Storage=
”选项控制是否存储日志数据,以及在哪里。可能的值为“ volatile
”、“ persistent
”、“ auto
”和“ none
”。默认为“ auto
”。
如果是“ volatile
”,则日志日志数据将仅存储在内存中,即低于 /run/log/journal 层次结构(如果需要则创建)。
如果“ persistent
”,数据将优先存储在磁盘上,即低于 /var/log/journal 层次结构(如果需要创建),并回退到 /run/log/journal(如果需要创建),在早期启动,如果磁盘不可写。
“ auto
”类似于“ persistent
”,但如果需要,/var/log/journal
则不会创建目录,因此它的存在控制了日志数据的去向。
" none
" 关闭所有存储,所有收到的日志数据都将被删除。
归档时间: |
|
查看次数: |
106260 次 |
最近记录: |