Show different colors for different lines based on http status
tail -f /var/log/nginx/access.log | awk ' / 200 / {print "\033[32m" $0 "\033[39m"} / 500 / {print "\033[31m" $0 "\033[39m"} / 302 / {print "\033[33m" $0 "\033[39m"} '
Creato
4y
|
19 giu 2021, 11:00:35
Accedi per aggiungere un commento
4y | 19 giu 2021, 11:02:36
or lightly better version
tail -f /var/log/nginx/niftycent.com_access.log | awk ' / 20[0-9] / {print "\033[32m" $0 "\033[39m"} / 50[0-9] / {print "\033[31m" $0 "\033[39m"} / 30[0-9] / {print "\033[33m" $0 "\033[39m"} '