Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Location
    Reporting Live from Marrz
    Posts
    257

    Code colouring maillog

    Does anyone know of a way to have maillog code coloured while it's tailed in shell?

  2. #2
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    14,134
    It's POSSIBLE to do this, but doing it would mean modifying the source of your email client, and it would make the file output useless for anyone who wants to just view the file through a real editor.
    Tom Whiting, WHMCS Guru extraordinaire
    Linux problems? WHMCS Problems? Give me a shout
    Check out my WHMCS Addons

  3. #3
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    1,097
    http://www.gnu.org/software/src-highlite/ is probably what you're looking for.

  4. #4
    Join Date
    Jul 2004
    Location
    Reporting Live from Marrz
    Posts
    257
    Originally posted by linux-tech
    It's POSSIBLE to do this, but doing it would mean modifying the source of your email client, and it would make the file output useless for anyone who wants to just view the file through a real editor.
    Agreed, and I would never want to do this - keep the logs standardized.

    I was thinking about coloring 'on the fly' (or better say 'on the scroll' - I know it's possible, I saw a Perl script the other day that someone used to highlights specific keywords - which didn't change the logging itself - just filtered in a way.

    So what error404 gave me as a link might also be useful - it actually generates a separate file from the log - good for periodical logfile analyzing. I'll certainly have a look at it.

    Thanks guys

  5. #5
    Join Date
    May 2005
    Location
    Scranton, PA
    Posts
    18
    You can do this with a program like color wrapper, which just wraps common unix text in ansi color. It's available at:

    http://freshmeat.net/projects/cw/

    I use it on all my linux boxes, it's nice to have some color splashed in there, makes some stuff easier to read. Not sure if it'll do the mail logs, but it should color when tailing. Try it out, if you like it, be sure to rate it at freshmeat, Vade79 is a good guy and could use the popularity
    BurstNET® - The Speed the Internet Travels™
    BurstNET® - an INC500™ Company
    BurstNET - 1-877-BURSTNET - sales@burst.net
    http://www.burst.net-http://www.nocster.net

  6. #6
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    1,097
    Originally posted by SupaDucta
    Agreed, and I would never want to do this - keep the logs standardized.

    I was thinking about coloring 'on the fly' (or better say 'on the scroll' - I know it's possible, I saw a Perl script the other day that someone used to highlights specific keywords - which didn't change the logging itself - just filtered in a way.

    So what error404 gave me as a link might also be useful - it actually generates a separate file from the log - good for periodical logfile analyzing. I'll certainly have a look at it.

    Thanks guys
    It's a little bit cooler than that :
    Code:
    source-highlight -s log -f esc < /var/log/mail.log
    Will highlight it with escape characters and print it to stdout. There's also a connector for use with the less pager that allows you to do something like 'less /var/log/mail.log' and have it automatically highlight (though it might take some tweaking, it doesn't seem to recognize logfiles, only common programming languages).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •