Colorize tail output

41 viewsbashlinuxshell
0

I’ve been trying to make tail a little more readable for server startups. My current command filters out most of the INFO and DEBUG messages from the startup:

tail -F ../server/durango/log/server.log | grep -e "ERROR" -e "WARN" -e "Shutdown" -e "MicroKernel" | grep --color=auto -E 'MicroKernel|$'

What I would like to do is craft something that would highlight WARN in yellow and ERROR in red, and MicroKernel in green. I tried just piping grep –color=auto multiple times, but the only color that survives is the last command in the pipe.

Is there a one liner to do this? Or even a many-liner?