mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
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:
parent
aa1d67a4de
commit
664d0ea023
1 changed files with 13 additions and 6 deletions
19
pihole
19
pihole
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue