正则表达式 "swatch monitor log file output"
Regular expression "swatch monitor log file output"
在/var/log/messages中,我会得到一个IDS的输出。像这样:
Feb 4 13:24:17 test1-1 snort[4535]: [122:1:1] (portscan) TCP Portscan [Classification: Attempted Information Leak] [Priority: 2] {PROTO:255} 10.0.0.1 -> 10.0.0.2
我所做的是,我用 swatch 监视 /var/log/messenges 文件,swatch 会将日志输出发送到 python 脚本,并且这将通过智能手机通知一些经理。
所以我想向经理输出更详细的信息。我使用的设置:
watchfor /.*(.*test1-1.*TCP Portscan.*).*/
exec command /usr/local/bin/send_msg "user" ""
输出将是这样的:
test1-1 snort[4535]: [122:1:1] (portscan) TCP Portscan
但我想要这样的东西,IP 地址总是随机的:
test1-1 TCP Postscan 10.0.0.1 -> 10.0.0.2
如何做到这一点?用正则表达式?
亲切的问候
来自您友好的系统管理员
这将捕获有趣的部分:
watchfor /(test1-1).*(TCP Portscan).*} (.*)/
exec command /usr/local/bin/send_msg "user" " "
在/var/log/messages中,我会得到一个IDS的输出。像这样:
Feb 4 13:24:17 test1-1 snort[4535]: [122:1:1] (portscan) TCP Portscan [Classification: Attempted Information Leak] [Priority: 2] {PROTO:255} 10.0.0.1 -> 10.0.0.2
我所做的是,我用 swatch 监视 /var/log/messenges 文件,swatch 会将日志输出发送到 python 脚本,并且这将通过智能手机通知一些经理。
所以我想向经理输出更详细的信息。我使用的设置:
watchfor /.*(.*test1-1.*TCP Portscan.*).*/
exec command /usr/local/bin/send_msg "user" ""
输出将是这样的:
test1-1 snort[4535]: [122:1:1] (portscan) TCP Portscan
但我想要这样的东西,IP 地址总是随机的:
test1-1 TCP Postscan 10.0.0.1 -> 10.0.0.2
如何做到这一点?用正则表达式?
亲切的问候
来自您友好的系统管理员
这将捕获有趣的部分:
watchfor /(test1-1).*(TCP Portscan).*} (.*)/
exec command /usr/local/bin/send_msg "user" " "