DevOps / Scripts bash Beginner

Colorized tail Log Viewer

Follow application logs and highlight ERROR, WARN, INFO lines with ANSI colors.

bash
#!/bin/bash
tail -f ${1:-/var/log/syslog} | awk '{
  if (/ERROR/)   print "\033[31m" $0 "\033[0m"
  else if (/WARN/) print "\033[33m" $0 "\033[0m"
  else if (/INFO/) print "\033[32m" $0 "\033[0m"
  else print $0
}'

Prerequisites

  • tail
  • awk

Pro Tips

  • → Works with any log file — pass path as argument.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
bash
Level
Beginner
Read time
1 min
Published
Jul 2025
License
Commercial License

Newsletter

New modules every week, directly to your inbox.