我正在跟踪我自己的应用程序和 postgres 的日志。
tail -f /tmp/myapp.log /var/log/postgresql/postgresql.main.log
Run Code Online (Sandbox Code Playgroud)
我需要包含 pgpool 的日志。它曾经是 syslog,但现在它在 journalctl 中。
有没有办法将 tail -f && journalctl -f 绑定在一起?
我正在寻找一种方法,可以简单地从 Debian 中的 systemctl 服务打印最后 X 行。我想将此代码安装到脚本中,该脚本使用打印的和最新的日志条目。我找到了这篇文章,但我无法根据我的目的修改它。
目前我正在使用这段代码,它只是给了我一小段日志文件:
journalctl --unit=my.service --since "1 hour ago" -p err
Run Code Online (Sandbox Code Playgroud)
为了举例说明结果应该是什么样子,只需为任何服务输入上面的命令并滚动到日志末尾。然后从底部开始复制最后 300 行。
我的想法是使用 egrep ex。egrep -m 700 .但从现在起我就没有运气了。
如果我输入,sudo journalctl我会在某种阅读器中获取系统日志。按 j 和 k 的工作方式与 Vi 中类似,但 G 不会转到文件末尾。事实上,如果按 G,流就会冻结,我已经强行终止它。
Journalctl 的手册页中没有提及使用阅读器。
我是 Linux 的新手。我看到的是两个运行方式大致相同的日志。为什么有两个日志?我希望在他们每个人中看到什么样的信息?它们的生命周期有何不同?
我想systemd在 CentOS 上观看服务的输出,就像我从控制台启动了这个服务一样。是的,我可以用 看到输出journalctl,但它不会自动滚动到底部。那么如何观看服务的实时输出呢?
我有一个运行我正在开发的服务的 Ubuntu 18.04 服务器。输出正在发送到系统日志以进行日志记录。
我不小心没有清理一些日志记录,并且一个明文密码(对于我自己的用户)被意外泄露到日志中。
我已经修复了服务的日志记录行为。现在我只想编辑日志文件以删除带有明文密码的行。
如何编辑journalctl文件?
最近三天我遇到了随机冻结。如果发生这种情况时我正在 youtube 上查看音频继续播放但屏幕被冻结并且键盘或光标不执行任何操作。
我试着往里看sudo journalctl,这就是我发现的:
led 04 10:44:02 arch-thinkpad kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe C (start=113031 end=113032) time 340 us, min 1073, max 1079, scanline start 1062, end 1085
led 04 11:09:15 arch-thinkpad kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe C (start=203838 end=203839) time 273 us, min 1073, max 1079, scanline start 1072, end 1090
led 04 11:15:47 arch-thinkpad kernel: i915 0000:00:02.0: [drm] *ERROR* Atomic update failure on pipe C …Run Code Online (Sandbox Code Playgroud) $ man journalctl
...
--setup-keys
Instead of showing journal contents, generate a new key pair for Forward Secure Sealing (FSS). This will generate a
sealing key and a verification key. The sealing key is stored in the journal data directory and shall remain on the
host. The verification key should be stored externally. Refer to the Seal= option in journald.conf(5) for
information on Forward Secure Sealing and for a link to a refereed scholarly paper detailing the cryptographic
theory it …Run Code Online (Sandbox Code Playgroud) 例如:
??[10:50:38/hypership/root/~]
??? journalctl -b
No journal files were found.
-- No entries --
??[10:50:46/hypership/root/~]
??? journalctl --verify
No journal files were found.
Run Code Online (Sandbox Code Playgroud)
/var/log虽然充满了文件,但这以前是有效的。似乎 Arch Linux 更新可能导致了这种情况。
知道可能是什么问题吗?我还能提供哪些信息?
journalctl --boot打印自启动以来的日志行并journalctl --follow打印日志的最后 10 行,然后跟踪它。但journalctl --boot --follow并不像我期望的那样工作。它不是打印自启动以来的所有日志行,然后跟随日志,而是忽略--boot标志。交换标志没有什么区别。如何打印自启动以来的所有日志行,然后跟踪日志?
版本信息:
$ journalctl --version
systemd 239
+PAM +AUDIT -SELINUX +IMA +APPARMOR +SMACK -SYSVINIT +UTMP -LIBCRYPTSETUP +GCRYPT -GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
Run Code Online (Sandbox Code Playgroud) journalctl ×10
systemd ×3
arch-linux ×2
linux ×2
dmesg ×1
encryption ×1
freeze ×1
kernel ×1
syslog ×1
systemctl ×1
tail ×1