3

I have some log files that are hard to read without coloring:

05-04-2014 19:04:17 < user!~user@something.net: this is what I say
05-04-2014 19:04:18 < anotheruser!~user@something.net: something else
07-06-2014 17:45:34 < andre!andre@shellhost/milliways: nslookup: can't resolve this ... 

Is there a way to watch this log file with colored usernames and without the domain (in this example without "@something.net")?

  • 1
    Without the domain = anotheruser!~user instead of anotheruser!~user@something.net? – unor Apr 6 '14 at 5:37
  • 1
    probably only the nick: anotheruser. I suggest writing it yourself with some scripting language, parse it with regexp and output HTML. – Johannes Kuhn Apr 6 '14 at 10:14
  • I know moinmoin wiki, and pastebin.org do the syntax highlighing. Pygments will do it (though I haven't used it myself, it is very popular) – Lyndon White Jun 10 '14 at 15:05
  • Not sure what you mean though "without the domain" – Lyndon White Jun 10 '14 at 15:06
3

I use ccze to colorize my logs, not chatlogs though. I'm uncertain if there is a plugin for chats already present (counldn't find one at first search) but you can write your own, which shouldn't be too hard.

ccze is used together with other tools on the commandline, e.G. cat like this:

cat myLogFromYesterday | ccze -A

It will print out a colorized log on the screen.

Heres the manpage to the plugin management that explains how to create one.

  • @rubo77 Do you use ccze for this task? How does it work out? – Angelo Fuchs Sep 22 '16 at 7:54
  • It is a really nice tool to colorize output, but there is no setting that works perfect on IRC logs. Maybe someone created a template for ccze? – rubo77 Sep 22 '16 at 8:33
3

You can put the chat-log in /tmp/chat.log and parse it with sed on the bash console:

COLOR=32
COLOR2=31
cat /tmp/chat.log \
 | sed 's/ \([[:alpha:][:digit:][:space:]@\.]*\)\!/ \x1b['${COLOR}'m\1\x1b[0m!~/1' \
 | sed 's/!~.*: /\x1b['${COLOR2}'m: \x1b[0m/'

Source for colorisazion: colourize the first part of each line

  • Be good to mention what the requirements are to that - I'm going to guess most unix systems include that by default? – Nick Wilde Jun 10 '14 at 15:34
  • @rubo77 If this is what you ended up using, you can accept your own answer as correct as well. That way a future visitor sees it first. – Angelo Fuchs Sep 22 '16 at 7:58

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.