awk 获取ip请求次数 可刷新运行 刷新

awk 获取ip请求次数

代码:

$ip=request()->getClientIp();

system("awk -F \" \" '{print $1}' /var/log/nginx/*.log | sort | uniq -c | sort -nr | grep {$ip} ");

//shell
//awk -F " " '{print $1}' /var/log/nginx/*.log | sort | uniq -c | sort -nr | grep

输出:

     40 3.235.66.217