2

Hello im looking for command like this

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

But based on activity from /var/log/nginx/access.log Im aware that access.log can't provide currently handled connections, so the best possible solution will be assumption that currently handled is equal one second in server access log.

Simply, how to display, in the exact same format grouped IP's by N connections made in last 1s in access.log

1 Answers1

2
ss -p | grep nginx | grep -i estab | wc -l

Will give you established connection count..

ss -p | grep nginx | grep -i estab | awk '{print $6}' | cut -f1 -d\: | sort -u

Will give you a uniquely sorted list of remote IP addresses..

These commands were run as root..

Tim
  • 31,888
  • 7
  • 52
  • 78