Correctly retrieve IPv4/6 addresses for tailFunc()

* Add comments for readability
* Use `sed -E` for readability
* Move `date` into `sed`
* Use updated colour codes
This commit is contained in:
WaLLy3K 2017-09-23 11:27:40 +10:00 committed by GitHub
parent aa1d67a4de
commit 664d0ea023

19
pihole
View file

@ -508,13 +508,20 @@ statusFunc() {
}
tailFunc() {
date=$(date +'%b %d ')
echo -e " ${INFO} Press Ctrl-C to exit"
tail -f /var/log/pihole.log | sed \
-e "s,\(${date}\| dnsmasq\[.*[0-9]]\),,g" \
-e "s,\(.*\(gravity.list\|black.list\| config \).* is \(${IPV4_ADDRESS%/*}\|${IPV6_ADDRESS:-NULL}\).*\),${COL_LIGHT_RED}&${COL_NC}," \
-e "s,.*\(query\[A\|DHCP\).*,${COL_NC}&${COL_NC}," \
-e "s,.*,${COL_DARK_GRAY}&${COL_NC},"
# Retrieve IPv4/6 addresses
source /etc/pihole/setupVars.conf
# Strip date from each line
# Colour blocklist/blacklist/wildcard entries as red
# Colour A/AAAA/DHCP strings as white
# Colour everything else as gray
tail -f /var/log/pihole.log | sed -E \
-e "s,($(date +'%b %d ')| dnsmasq[.*[0-9]]),,g" \
-e "s,(.*(gravity.list|black.list| config ).* is (${IPV4_ADDRESS%/*}|${IPV6_ADDRESS:-NULL}).*),${COL_RED}&${COL_NC}," \
-e "s,.*(query\\[A|DHCP).*,${COL_NC}&${COL_NC}," \
-e "s,.*,${COL_GRAY}&${COL_NC},"
exit 0
}