awk 统计访问时间超过1000毫秒的接口
日志格式如下:
2013-01-10 15:21:44:815 INFO [catalina-exec-115] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=23ms, servletPath=/requestResumeInfo/findResume.json, clientIP=10.10.10.22, input={"data":"3721","client_id":"20007","view_id":"64670"}, output={"status":0,"message":"OK","data":{"res_id":3721,"sysResumeDto":{"res_id":3721,"user_id":4963,"delflag":"0","res_caption":"中文简历_20130110","res_tel":"13808080808","res_email":"[email protected]","res_langkind":"0","res_edulevel":"050","res_workyear":2004,"res_nowsalary":7500,"res_format":"0","res_category":"1","res_wantdq":"010,020,050","res_wantindustry":"000","res_wantjobtitle":"020010","res_wantsalary":0,"res_salmonths":12,"res_birth_year":1976,"res_industry":"000","res_jobtitle":"020010","res_dq":"010"(... more 1671 chars ignored)
2013-01-10 15:21:44:825 INFO [catalina-exec-138] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=2ms, servletPath=/requestResumeInfo/findUserCId.json, clientIP=10.10.10.22, input={"data":"10660","client_id":"20007","view_id":"638"}, output={"status":0,"message":"OK","data":13498}
2013-01-10 15:21:44:844 INFO [catalina-exec-24] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=21ms, servletPath=/requestResumeInfo/findResume.json, clientIP=10.10.10.22, input={"data":"150051","client_id":"20007","view_id":"103584"}, output={"status":0,"message":"OK","data":{"res_id":150051,"sysResumeDto":{"res_id":150051,"user_id":291836,"delflag":"0","res_caption":"中文简历_20130110","res_tel":"13808080808","res_email":"[email protected]","res_langkind":"0","res_edulevel":"040","res_workyear":2005,"res_nowsalary":0,"res_format":"0","res_category":"1","res_wantdq":"020,060020,070030","res_wantindustry":"190","res_wantjobtitle":"020020","res_wantsalary":0,"res_salmonths":12,"res_birth_year":1981,"res_industry":"190","res_jobtitle":"120110","res_(... more 3026 chars ignored)
2013-01-10 15:21:44:846 INFO [catalina-exec-117] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=51ms, servletPath=/requestResumeInfo/findResumesByUserCId.json, clientIP=10.10.10.22, input={"data":"269551?","client_id":"20004","view_id":"269551"}, output={"status":0,"message":"OK","data":[{"res_id":129684,"sysResumeDto":{"res_id":129684,"user_id":269551,"delflag":"0","res_caption":"中文简历_20130110","res_tel":"13808080808","res_email":"[email protected]","res_langkind":"0","res_edulevel":"050","res_workyear":1984,"res_nowsalary":0,"res_format":"0","res_category":"1","res_wantdq":"100,020","res_wantindustry":"350,120,240","res_wantjobtitle":"010040,090010,090030","res_wantsalary":0,"res_salmonths":12,"res_birth_year":1983,"res_industry":"350","res_jobtitle":"(... more 6099 chars ignored)
2013-01-10 15:21:44:854 INFO [catalina-exec-112] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=3ms, servletPath=/requestResumeInfo/findUserCId.json, clientIP=10.10.10.22, input={"data":"9310","client_id":"20007","view_id":"638"}, output={"status":0,"message":"OK","data":0}
2013-01-10 15:21:44:854 INFO [catalina-exec-109] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=26ms, servletPath=/requestResumeInfo/findResume.json, clientIP=10.10.10.22, input={"data":"63961","client_id":"20007","view_id":"140828"}, output={"status":0,"message":"OK","data":{"res_id":63961,"sysResumeDto":{"res_id":63961,"user_id":85396,"delflag":"0","res_caption":"中文简历_20130110","res_tel":"13808080808","res_email":"[email protected]","res_langkind":"0","res_edulevel":"030","res_workyear":2003,"res_nowsalary":0,"res_format":"0","res_category":"1","res_wantdq":"010","res_wantindustry":"080","res_wantjobtitle":"170070,170140","res_wantsalary":0,"res_salmonths":12,"res_birth_year":1979,"res_industry":"080","res_jobtitle":"170070","res_dq":"010",(... more 2709 chars ignored)
2013-01-10 15:21:44:868 INFO [catalina-exec-59] com.lietou.common.filter.AbstractIOLogger | status=0, eclipse=17ms, servletPath=/requestResumeInfo/findResume.json, clientIP=10.10.10.22, input={"data":"4874","client_id":"20007","view_id":"32150"}, output={"status":0,"message":"OK","data":{"res_id":4874,"sysResumeDto":{"res_id":4874,"user_id":6112,"delflag":"0","res_caption":"中文简历_20130110","res_tel":"13808080808","res_email":"[email protected]","res_langkind":"0","res_edulevel":"040","res_wo
测试命令如下:
cat eventInfo.log |sed 's/ms,//g' |awk '{ if (substr($8,9) -100 >0 ) print}'|awk '{print $9}'|sort|uniq -c|sort -nr|head
测试结果如下:
2712 servletPath=/requestResumeInfo/findResumesByUserCId.json,
2626 servletPath=/requestResumeInfo/findResume.json,
2457 servletPath=/requestResumeInfo/findResumes.json,
1084 servletPath=/requestResumeInfo/findSysResume.json,
577 servletPath=/requestResumeInfo/findResumeRefreshTime.json,
340 servletPath=/requestResumeInfo/findResumeIdsByUserCId.json,
131 servletPath=/requestResumeInfo/findResumeContact.json,
93 servletPath=/requestResumeInfo/findOtherResIdById.json,
66 servletPath=/requestResumeInfo/modifyResumeCategory.json,
61 servletPath=/requestResumeInfo/autoRefreshResumes.json,