The tail command is frequently used to monitor log files. In this short tutorial, we'll discuss approaches to augmenting tail 's output with colors to highlight important information conveyed by log files. 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? Another solution, if you're on a server where it's inconvenient to install non- standard tools, is to combine tail. Adding export CLICOLOR_FORCE=1 to ~/.zshrc or ~/.bashrc, depending on the shell you use, keeps the colors when piping ls to other commands like less, head, and tail.
Monitoring apache logs with tail -f tends gets very frustrating for the eyes after a while. Are there any tool/options to colorize the log outputs? Maybe signal FATAL with red, etc. Color output of linux tail command.
GitHub Gist: instantly share code, notes, and snippets. $ tail -f /var/log/syslog grep --color=always "error\ warning" This command will display only lines containing "error" or "warning" as they are added to the syslog file, and highlight these words in color. Add a comment Start asking to get answers Find the answer to your question by asking.
Ask question Explore related questions linux colors tail. Note: This option -f is very useful on sysadmin tasks, not only with colortail but also with tail, and it cause to left open the displaying of the content of the file and continuously add new files that are added in real time to the file by the corresponding linux service. +1 for the function as a variable trick but this won't run head or tail on the files, it will color-cat them and only run head if the file type is unknown.
I think the OP wants to run a colored head, tail etc.