Skip to content

Instantly share code, notes, and snippets.

@dev-rke
dev-rke / livestats.sh
Last active January 29, 2026 22:45
logfile live statistics (e.g. for apache & nginx)
#!/bin/sh
##
## livestats.sh - an awk based realtime aggregation of logfiles
##
## USAGE EXAMPLES
## tail -f access.log | livestats.sh
## tail -n 10000 access.log | livestats.sh -c 10 -n 20 -l 0
## zcat access.log.2.gz | grep POST | livestats.sh -c 7 -l 0 -n 5
## ./livestats.sh -f access.log
##
@dev-rke
dev-rke / default.conf
Created January 9, 2025 13:20
nginx user agent based rate limiting to block AI Bot crawlers
# This nginx configuration demonstrates how to set up
# user agent based rate limiting to restrict AI Bots
# in case of huge system load caused by bots
# Typically these bots come from several IP ranges
# and are hard to restrict manually.
# Unfortunately these AI bots ignore meta robots tags
# and don't understand robots.txt very well.
# For more details regarding blocking in nginx, see