我正在尝试/var/log/secure
使用正则表达式对字符串进行数学运算,以获取是否存在 ssh 身份验证失败。
如果身份验证失败,它在日志文件中将如下所示:
Oct 31 07:52:41 logserver sshd[17041]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost
我试着做这样的事情:
"\\<sshd[^:]*: pam_unix(sshd:auth): authentication failure; ./* \\>"
但它不起作用。如果有人可以帮助我处理正则表达式,我将不胜感激。
这是在 CentOS 7 机器上,正则表达式用于 collectd 的 plugin tail
。