Skip to content

Instantly share code, notes, and snippets.

@sponomarev
Created September 15, 2014 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sponomarev/b43bf2a7453f427a21e9 to your computer and use it in GitHub Desktop.
Save sponomarev/b43bf2a7453f427a21e9 to your computer and use it in GitHub Desktop.
Usefull commands when you are under ddos
# Позволяет получить общую картину: распределение уникальных IP, с которых идут запросы, кол-во запросов с одного IP и т.д.
tail -f /var/log/nginx/nginx.access.log | cut -d ' ' -f 1 | logtop
# Покажет распределение какой-либо строки по IP в логе.
grep "&key=" /var/log/nginx/nginx.access.log | cut -d ' ' -f 1 | sort | uniq -c | sort -n | tail -n 30
# С какого ip сколько запросов
netstat -ntu | awk '{print $5}'| cut -d: -f1 | sort | uniq -c | sort -nr | more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment