dnsqsum script

DNS Query Summary Script สำหรับ Summary DNS Query Log เพื่อดูว่ามีการ query มาจาก host ใหน และ query domain ใหนบ้าง โดยแสดงเฉพาะ Top 10 — quick & dirty version — #!/bin/bash QLOG=”/var/log/named/query.log” [ ! -f “$QLOG” ] && echo “Log file ‘$QLOG’ doesn’t exist?” && exit DCOL=6 V=`head -1 $QLOG | cut -f5 -d’ ‘` if [ “$V” = “view” ]; then DCOL=8 fi echo “===== Source of Query =====” cat $QLOG | cut -f4 -d’ ‘ | cut -f1 -d’#’ | sort | uniq -c | sort -rn | head echo “=———————-=” echo “===== Domain to Query =====” cat $QLOG | cut -f$DCOL -d’ ‘ | sort | uniq -c | sort -rn | head echo “=———————-=”

Read More »