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...
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...
I'm using multitail to monitor logs, it includes coloring as well as multiple logfile monitoring either merged or in windows. Give it a try.
Any reason why you can't use something like this:
source: commandlinefu.com
I use a small script with grep combinations to get some colors:
The point is that every chained grep add a different color. So the result is something like:
Found this: http://fixunix.com/unix/83044-tail-color.html
This only works on ANSI terminals, but all others have become virtually extinct. \e[...m ist the ANSI escape sequence SGR "select graphic rendition". The "..." can be replaced by some semicolon-separated integers, with the meaning:
0 : all attributes off 1 : bold 31 : foreground red 43 : background yellow
"keyword", of course, can be any perl regular expression:
(foo|bar) highlight the strings foo and bar \b((foo|bar)\b highlight the words foo and bar .\b((foo|bar)\b. highlight the whole line that contains the words foo or bar
Or, the easy way, just install
colortail
Its probably in your favorite repo (dag for CentOS)http://developwithstyle.com/articles/2010/04/20/tail-your-logs-with-a-touch-of-color.html
http://joakimandersson.se/projects/colortail/
Shameless plug: I wrote a tool called TxtStyle that does something similar as the options mentioned earlier. You can run it as follows:
You can also define named styles in the config file (
~/.txts.conf
) and use it like so:(
ifconfig
style is defined out of the box)There's one feature that I haven't seen in those colorizers -- highlight response times (higher time -> more alarming color). 256-color support in modern terminal emulators could be useful here.
Another useful grep trick to show all output but colour the selected KEYWORD is :
From all responses above this is what I got and it works very nicely
Terminal Screen Shot
I spent many years as a sysadmin for an MX-level email antivirus & antispam service & while trying to help myself out of a semi-dyslexic maillog tailing session, one hyper-spamming event, I knocked this little script up, that allowed me to selectively highlight various interesting log entries.
https://github.com/furriephillips/hl
Please be gentle - this was the creation of a madman, being spammed into kingdom come.
This should work fine, on any log you are tailing, as you can tailor the bits that get highlighted & in what colour & gradually work your way up to a fully personalised experience, perhaps with per-log command aliases, like this random & not very useful example: -
alias hlmaillog="tail -F /var/log/maillog | hl NOQUEUE lightblue | hl 'blocked using zen' pink | hl warning yellow | hl 'Name or service not known' pink | hl 'TLS connection established' yellow | hl TIMING lightblue | hl dkim red"