我试图查看在“午夜之前”(昨天的最后一刻)到之后在我的系统上记录的内容。
~ # journalctl --since "2019-09-09 23:59" --until "2019-09-10 00:10"
-- Logs begin at Mon 2019-08-05 09:48:15 CEST, end at Tue 2019-09-10 17:04:00 CEST. --
~ #
输出为空,我被告知从一个月前到现在有可用的日志。为什么不显示?
裸机journalctl
显示大量日志(从 8 月开始,现在结束)
~ # journalctl | tail -5
Sep 10 17:10:53 srv synapse[1111]: 2019-09-10 17:10:53,792 synapse.access.http.8008 (...)
Sep 10 17:11:00 srv caddy[1111]: (...)
Sep 10 17:11:02 srv mqtt[1111]: 1568128262: New (...)
Sep 10 17:11:02 srv mqtt[1111]: 1568128262: New(...)
Sep 10 17:11:02 srv mqtt[1111]: 1568128262: Client (...)
~ # journalctl | head -5 root@srv
-- Logs begin at Mon 2019-08-05 09:48:15 CEST, end at Tue 2019-09-10 17:13:23 CEST. --
Aug 05 09:48:15 srv systemd[15247]: Stopped target Default.
Aug 05 09:48:15 srv systemd[15247]: Stopped target Basic System.
Aug 05 09:48:15 srv systemd[15247]: Stopped target Paths.
Aug 05 09:48:15 srv systemd[15247]: Stopped target Timers.
编辑1:该时间范围内有事件:
~ # less /var/log/syslog.1
(...)
Sep 10 00:07:41 srv systemd[1]: Started Session 109446 of user root.
(...)
编辑2:有趣的是,在另一个时间范围内,我得到了事件,但不是从那个时间范围:
~ # journalctl --since "2019-09-09 18:00" --until "2019-09-10 19:00"
-- Logs begin at Mon 2019-08-05 09:48:15 CEST, end at Tue 2019-09-10 19:21:44 CEST. --
Sep 10 15:51:26 srv systemd[468]: pam_unix(systemd-user:session): session opened for user root by (uid=0)
Sep 10 15:51:26 srv audit[468]: USER_START pid=468 uid=0 auid=0 ses=146446 msg='op=PAM:session_open acct="root" exe="/lib/systemd/systemd" hostname=? addr=? t
Sep 10 15:51:26 srv systemd[468]: Reached target Paths.
这是因为
journald
存储了定义大小的日志,你可以看到当前大小配置此行为并添加许多其他行为
资源
您的默认磁盘大小可能太小而无法容纳 24 小时日志