免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2477 | 回复: 2
打印 上一主题 下一主题

[文本处理] 日志正则匹配 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-02-29 17:39 |显示全部楼层 |倒序浏览
小弟有个问题咨询一下:
Feb 29 17:26:16 sa2xxb002 sshd[17965]: Received disconnect from 192.168.13.137: 11: disconnected by user

以上这条linux的登陆日志,我用正则只能匹配到:之前,小弟请教,后半部分怎么匹配,求大牛们告知一下

论坛徽章:
0
2 [报告]
发表于 2016-02-29 18:17 |显示全部楼层
回复 2# 我是一隻羊


    匹配  Received disconnect from 192.168.13.137: 11: disconnected by user

论坛徽章:
0
3 [报告]
发表于 2016-02-29 18:24 |显示全部楼层
回复 3# jason680


sorry,小弟问题没说清楚,小弟原日志

Feb 29 18:15:30 sa2liub002 sshd[21489]: Accepted publickey for shsuper from 192.168.13.137 port 55063 ssh2

现在通过grok match匹配如下:
"message" => [
        [0] "Feb 29 18:17:51 sa2liub002 sshd[21493]: Received disconnect from 192.168.13.137: 11: disconnected by user",
        [1] "Received disconnect from 192.168.13.137: 11: disconnected by user"
    ],
                "@version" => "1",
              "@timestamp" => "2016-02-29T10:17:51.950Z",
                    "host" => "sa2liub002",
                    "path" => "/var/log/secure",
                    "type" => "syslog",
               "timestamp" => "Feb 29 18:17:51",
               "logsource" => "sa2liub002",
                 "program" => "sshd",
                     "pid" => "21493",
    "syslog_severity_code" => 5,
    "syslog_facility_code" => 1,
         "syslog_facility" => "user-level",
         "syslog_severity" => "notice"

但是Accepted publickey for shsuper from 192.168.13.137 port 55063 ssh2 这一部分不知道怎么去匹配。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP