统计nginx日志,查看调用api最高的app top10

有个需求,是统计nginx访问日志,统计出调用rest api最高的用户app前10,每分钟统计一次。 nginx定义的日志格式: ‘V1 [$time_iso8601] $remote_addr $host $request ‘ # Request ‘$status $body_bytes_sent $bytes_sent $request_time ‘ # Response ‘”$http_referer” “$http_user_agent” “$http_x_forwarded_for” ‘ # Client ‘$tcpinfo_rtt,$tcpinfo_rttvar,$tcpinfo_snd_cwnd,$tcpinfo_rcv_space ‘ # NET ‘$upstream_addr $upstream_status $upstream_response_time’; # Upstream 如下为日志返回的三种状态(200,40x, 50x) 207.247.141.184 a1.XXX.com – [2015-11-29T09:42:05+08:00] “POST /qudeo/xiying/devices HTTP/1.1” 503 740 “-” “XXX-SDK(Android) 2.1.3” “-” 0.316 – Read more…