Skip to content

Instantly share code, notes, and snippets.

@parsibox
Created November 1, 2024 17:26
Show Gist options
  • Save parsibox/263d0b2a813702064f6ce949b2314351 to your computer and use it in GitHub Desktop.
Save parsibox/263d0b2a813702064f6ce949b2314351 to your computer and use it in GitHub Desktop.
nginx error log get clientip
grep -oP '(?<=client: )[\d.]+(?=,)' /var/log/nginx/error.log | sort | uniq -c | sort -nr | head -n 20
@parsibox
Copy link
Author

parsibox commented Nov 1, 2024

mv /var/log/nginx/error.log /var/log/nginx/$(date +%F).error.log && kill -USR1 $(cat /run/nginx.pid)

mv /var/log/nginx/access.log /var/log/nginx/$(date +%F).access.log && kill -USR1 $(cat /run/nginx.pid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment