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

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?

  • 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

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

cs_re:green,,bold:All session\(s\) filled for.* 
| 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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