log visited IPs / hostnames on router



1) add iptables rule
iptables -A FORWARD -p tcp        -s $MONITORED_HOST   --destination-port 80     --match state --state NEW   --jump LOG --log-prefix "Visited websites "

2) parse log via cron (eg. hourly)
cat /var/log/messages | grep -i "Visited websites" | cut -d" " -f1-3,10,19 >> /var/log/visited-websites
sort -u /var/log/visited-websites > /var/log/visited-websites-unique

3) resolve IPs to hosts
cat /var/log/visited-websites-unique | cut -d" " -f4 | cut -d"=" -f2 | sort -u > /var/log/visited-websites-unique-ips
Last update:
2012-06-14 13:18
Author:
Daniel
Revision:
1.2
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.