美文网首页
查询nginx日志状态码大于400的请求,并打印整行

查询nginx日志状态码大于400的请求,并打印整行

作者: langlyyy | 来源:发表于2021-10-22 14:18 被阅读0次

    tail -20 ip-access.log |awk -F',' '$4>=400 {print $0}'
    说明:
    -F 以什么分隔列
    $4 代表第二列
    $2>400 代表第二列大于400
    print $0 代表输出一整行

    root@langly:/data/logs/nginx# tail -20 ip-access.log  |awk -F',' '$4>=400 {print $0}'
    193.188.22.152,2020-02-01T10:46:05+08:00,"\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr",400,154,"-","-","-","-",-,0.866,-
    114.245.45.181,2020-02-01T12:06:08+08:00,"\x04\x01\x00P{~hDMOZ\x00",400,154,"-","-","-","-",-,0.041,-
    114.245.45.181,2020-02-01T12:56:37+08:00,"\x05\x01\x00",400,154,"-","-","-","-",-,0.042,-
    91.225.111.6,2020-02-01T15:06:24+08:00,"{D79E94C5-70F0-46BD-965B-E17497CCB598}",400,154,"-","-","-","-",-,0.266,-
    5.188.210.101,2020-02-01T15:41:47+08:00,"\x05\x01\x00",400,154,"-","-","-","-",-,0.296,-
    5.188.210.101,2020-02-01T15:44:02+08:00,"\x04\x01\x00P\x05\xBC\xD2e\x00",400,154,"-","-","-","-",-,5.005,-
    

    相关文章

      网友评论

          本文标题:查询nginx日志状态码大于400的请求,并打印整行

          本文链接:https://www.haomeiwen.com/subject/uzncaltx.html