在Ubuntu日志中设置警报通知,可使用以下方法:
/etc/rsyslog.conf或/etc/rsyslog.d/下的配置文件,添加规则将特定级别日志发送到邮箱或执行脚本。如if $syslogseverity-text == 'alert' then @@your-email-server:514,将your-email-server替换为邮件服务器地址。/etc/logwatch/conf/logwatch.conf,设置MailTo为接收通知的邮箱,还可设置日志级别等参数,运行sudo logwatch --output mail即可发送通知。