Mar*_*mes 35 arch-linux systemd journald
我正在尝试使用journalctl
的模式匹配SYSLOG_IDENTIFIERS
。例如,我有大量消息标记为sshd
:
$ journalctl -t sshd | wc -l
987
Run Code Online (Sandbox Code Playgroud)
但是如果我尝试使用模式匹配来找到它们:
$ journalctl -t 'ssh*'
-- No Entries --
$ journalctl -t 'ssh.*'
-- No Entries --
Run Code Online (Sandbox Code Playgroud)
journalctl 手册页说模式应该有效,但我找不到关于如何在 systemd 中使用/定义模式的任何其他信息。
$ man journalctl
....
-t, --identifier=SYSLOG_IDENTIFIER|PATTERN
Show messages for the specified syslog identifier SYSLOG_IDENTIFIER,
or for any of the messages with a "SYSLOG_IDENTIFIER" matched by PATTERN.
Run Code Online (Sandbox Code Playgroud)
我正在运行 ArchLinux:
$ journalctl --version
systemd 225
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP
+GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD +IDN
Run Code Online (Sandbox Code Playgroud)
Tim*_*ner 30
这是一个文档错误,当man
页面中的错字更新时被关闭。
我们实际上并不接受模式,因此不要声称如此。
作为一种解决方法,您可以按照grep
问题评论中的建议使用。像这样的东西:
journalctl | grep sshd
Run Code Online (Sandbox Code Playgroud)
Dav*_*ave 16
Journalctl -v 239 支持过滤-g
Run Code Online (Sandbox Code Playgroud)-g, --grep= Filter output to entries where the MESSAGE= field matches the specified regular expression. PERL-compatible regular expressions are used, see pcre2pattern(3) for a detailed description of the syntax. If the pattern is all lowercase, matching is case insensitive. Otherwise, matching is case sensitive. This can be overridden with the --case-sensitive option, see below.
归档时间: |
|
查看次数: |
59479 次 |
最近记录: |