部分日志文本格式内容
[2023-12-18 22:40:52.301][INFO ][221][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:14.111.199.218, CLIENT:ANDROID, URI:/excellent/userMessage/v2/public/list, 「GET」
[2023-12-18 22:40:52.297][INFO ][209][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:14.111.199.218, CLIENT:ANDROID, URI:/excellent/notice/v2/public/list, 「GET」
[2023-12-18 22:40:52.154][INFO ][8534][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:14.111.199.218, CLIENT:ANDROID, URI:/excellent/app/v2/public/version, 「POST」
[2023-12-18 22:40:52.238][INFO ][324305][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:14.111.199.218, CLIENT:ANDROID, URI:/excellent/app/v2/public/news/list, 「POST」
[2023-12-18 22:40:52.323][INFO ][324309][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:14.111.199.218, CLIENT:ANDROID, URI:/excellent/app/depth/config/v2/public/get, 「GET」
[2023-12-18 22:40:53.162][INFO ][324290][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:172.16.10.52, CLIENT:OUT_SERVICE, URI:/excellent/api/v2/getUserInfoByToken, 「POST」
[2023-12-18 22:40:53.213][INFO ][324214][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:117.129.5.140, CLIENT:ANDROID, URI:/excellent/public/app/v2/banner/list, 「POST」
[2023-12-18 22:40:53.213][INFO ][324269][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:197.210.53.163, CLIENT:ANDROID, URI:/excellent/app/contract/v2/public/realTimeExchangeRate, 「GET」
[2023-12-18 22:40:53.214][INFO ][324238][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:1.204.247.208, CLIENT:ANDROID, URI:/excellent/app/self/select/v2/public/get, 「POST」
[2023-12-18 22:40:53.215][INFO ][324222][com.excellent.common.core.security.filter.UrlRedirectFilter.doFilter:131] ----------------->>> 请求进入拦截器,IP:1.204.247.208, CLIENT:ANDROID, URI:/excellent/app/self/select/v2/public/get, 「POST」
1、统计接口的访问情况
grep "请求进入" info_2023-12-18_77.log |awk -F ",|:|," '{a[$5] += 1;} END {for (i in a) printf("%d %s\n", a[i], i);}' | sort -n|tail -10
输出结构
398 CLIENT:ANDROID, URI:/excellent/app/sys/config/v2/get
406 CLIENT:ANDROID, URI:/excellent/app/account/v2/list
424 CLIENT:ANDROID, URI:/excellent/app/depth/config/v2/public/get
465 CLIENT:ANDROID, URI:/excellent/trade/mapping/v2/public/list
523 CLIENT:ANDROID, URI:/excellent/app/contract/v2/contractFinancial
703 CLIENT:ANDROID, URI:/excellent/app/contract/v2/getInfo
773 CLIENT:ANDROID, URI:/excellent/app/user/v2/get
1177 CLIENT:ANDROID, URI:/excellent/app/contract/v2/public/realTimeExchangeRate
1262 CLIENT:ANDROID, URI:/excellent/userMessage/v2/public/list
1521 CLIENT:ANDROID, URI:/excellent/app/self/select/v2/public/get
2、统计IP访问情况
grep "请求进入" info_2023-12-18_79.log |grep -v "172.16"|grep "/app/self/select"|awk -F ",|>" '{a[$4] += 1;} END {for (i in a) printf("%d %s\n", a[i], i);}' | sort -n |tail -10
输出结构
60 请求进入拦截器,IP:111.17.42.103
62 请求进入拦截器,IP:117.136.75.135
63 请求进入拦截器,IP:120.32.205.191
64 请求进入拦截器,IP:113.102.70.157
64 请求进入拦截器,IP:223.104.3.171
65 请求进入拦截器,IP:117.136.86.235
73 请求进入拦截器,IP:223.68.94.121
81 请求进入拦截器,IP:223.104.29.202
86 请求进入拦截器,IP:117.129.5.140
201 请求进入拦截器,IP:106.228.76.17
3、统计各个接口每分钟的访问量
grep "请求进入" info_2023-12-18_79.log | awk -F ",|:|," '{time=$2; split(time, arr, ":"); hour=arr[1]; minute=arr[2]; timestamp=hour*60+minute; a[$5]++; b[$5","int(timestamp/15)*15]++} END {for (i in a) printf("接口 %s 平均每分钟访问量: %.2f\n", i, a[i]*60/(timestamp+1))}' | sort -n -k 7
输出结构
接口 CLIENT:WEB, URI:/excellent/user/v2/topInfo 平均每分钟访问量: 0.03
接口 CLIENT:WEB, URI:/excellent/v2/public/bulletBox 平均每分钟访问量: 0.21
接口 CLIENT:WEB, URI:/excellent/v2/public/current/market 平均每分钟访问量: 0.42
接口 CLIENT:WEB, URI:/excellent/v2/public/getLoginQrCode 平均每分钟访问量: 0.05
接口 CLIENT:WEB, URI:/excellent/v2/public/pricingMethodSwitching 平均每分钟访问量: 1.53
接口 CLIENT:WEB, URI:/excellent/v2/public/scanLoginQuery 平均每分钟访问量: 0.39
接口 CLIENT:WEB, URI:/excellent/v2/public/trade/mapping/list 平均每分钟访问量: 0.92
接口 CLIENT:WEB, URI:/excellent/v2/public/web/login 平均每分钟访问量: 0.13
接口 CLIENT:WEB, URI:/excellent/v2/public/web/register/complete 平均每分钟访问量: 0.05
接口 CLIENT:WEB, URI:/excellent/v2/public/web/register/verify 平均每分钟访问量: 0.16
接口 CLIENT:WEB, URI:/open/depth/config 平均每分钟访问量: 0.05
接口 CLIENT:WEB, URI:/open/exchange/trade/area/all 平均每分钟访问量: 0.03