Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to use multitail to tail logs with color highlights. I defined a custom color scheme in multitail.conf, something like this:

colorscheme:my-color
cs_re:red:^\[E
cs_re:yellow:^\[W
cs_re:magenta:^\[D
cs_re:green,,bold:All session(s) filled for.* 

What I want to achieve with each line:

  1. Color the whole log-line Red if it starts with string '[E'
  2. Color ................................ Yellow if it starts with string '[W'
  3. Color ................................ Magenta if it starts with string '[D'
  4. Color ................................ Green if the line contains the string 'All session(s) filled for'

Unfortunately, none of the above is happening for me. For the first 3, it does color correctly the substring (e.g. '[E', '[W', etc) but not the whole log-line. In the last case, it doesn't color at all.

I also want to color the whole line by matching the third character of a line, e.g. color it Blue if the third character is 'A', how should I do this reliably with multitail?

share|improve this question
1  
I don't use multi-tail, but have you tried e.g.: cs_re:red:^[E.* ? Meh: the edit field is taking the backslash off the square bracket when I save :/ –  tink Apr 12 '13 at 21:44

1 Answer 1

up vote 1 down vote accepted

I don't use multitail, but looking to your regular expressions, you probably mean this:

colorscheme:my-color
cs_re:red:^\[E.*
cs_re:yellow:^\[W.*
cs_re:magenta:^\[D.*
cs_re:green,,bold:All session\(s\) filled for.* 
share|improve this answer
    
that works. How about matching the nth character in the line? –  MLister Apr 12 '13 at 23:15
    
^.{n-1}C where n is the char position and C is the character you want to match –  RSFalcon7 Apr 12 '13 at 23:31
1  
explanation: ^ matches the beginning of the line, . matches anything except \n, {n} repeats the last expression n times, and C matches your character –  RSFalcon7 Apr 12 '13 at 23:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.