Preface: python statistics apache, nginx access log IP visits and sorting (20 before the show). In fact, it can be achieved using awk + sort commands can also be implemented in awk array here just to try using the following python.
apache script:
nginx script:
Transfer from
python statistics apache, nginx access log IP visits and sorting (front display 20) - Seri -51CTO blog
https://blog.51cto.com/net881004/2134826