From 9627b27f1586707e514b23929d69627ee32034b9 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 29 Jul 2015 12:22:28 +0100 Subject: [PATCH] pihole logfile changes https://github.com/jacobsalmela/pi-hole/pull/27 --- advanced/Scripts/chronometer.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/chronometer.sh b/advanced/Scripts/chronometer.sh index 07cbbc00..74d08326 100755 --- a/advanced/Scripts/chronometer.sh +++ b/advanced/Scripts/chronometer.sh @@ -11,13 +11,13 @@ do uptime | cut -d' ' -f11- echo "-------------------------------" # Uncomment to continually read the log file and display the current domain being blocked - #tail -f /var/log/daemon.log | awk '/\/etc\/hosts/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/hosts") print $7; else;}' + #tail -f /var/log/pihole.log | awk '/\/etc\/hosts/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/hosts") print $7; else;}' today=$(date "+%b %e") - todaysQueryCount=$(cat /var/log/daemon.log | grep "$today" | awk '/query/ {print $7}' | wc -l) - todaysQueryCountV4=$(cat /var/log/daemon.log | grep "$today" | awk '/query/ && /\[A\]/ {print $7}' | wc -l) - todaysQueryCountV6=$(cat /var/log/daemon.log | grep "$today" | awk '/query/ && /\[AAAA\]/ {print $7}' | wc -l) - todaysAdsEliminated=$(cat /var/log/daemon.log | grep "$today" | awk '/\/etc\/hosts/ {print $7}' | wc -l) + todaysQueryCount=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ {print $7}' | wc -l) + todaysQueryCountV4=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[A\]/ {print $7}' | wc -l) + todaysQueryCountV6=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[AAAA\]/ {print $7}' | wc -l) + todaysAdsEliminated=$(cat /var/log/pihole.log | grep "$today" | awk '/\/etc\/hosts/ {print $7}' | wc -l) dividend=$(echo "$todaysAdsEliminated/$todaysQueryCount" | bc -l) fp=$(echo "$dividend*100" | bc -l) percentAds=$(echo ${fp:0:4}) @@ -25,4 +25,4 @@ do echo "Queries: $todaysQueryCountV4 / $todaysQueryCountV6" echo "Pi-holed: $todaysAdsEliminated ($percentAds%)" sleep 5 -done \ No newline at end of file +done