Personal IRC logging for easy remote reading

There’s a plethora of knowledge and insightful conversations that continue 24/7 on IRC. I’ve looked into easy ways to read these conversations at my leisure, but all the ‘ready-made’ apps came up short. I ended up using some scripts on my NAS to maintain a current archive of conversations in HTML format viewable remotely from any browser.

I’ll start off by mentioning my requirements and the apps I tried.

Requirements:

  • Run remotely on either my NAS (preferable) or my always-on Windows XP ‘server’ box.
  • Easily view logs from my main desktop, and preferably any other box I give access to.
  • Doesn’t require a separate IRC ‘presence’ like a bot. (Bots aren’t always welcome, and I want the ability to send messages from the name I’m always logged-in as)

Apps Tried:

  • mIRC – I actually started off using mIRC with logging enabled on my Windows ‘server’ box. The plain-text logs are quite hard to read though, and I couldn’t get the only mIRC to HTML converter I could find (ircLOG2HTML) to work. X-Chat 2 also had the same types of problems.
  • A variety of Windows IRC logger ‘bots’ (e.g. ircA). These worked somewhat, but their log formats still weren’t all that great, and they had the disadvantages of being similar to bots (see ‘Requirements’)

Having tried many of the Windows clients, I decided to try out the (argueably?) best linux client, Irssi, on my NAS. I’d used Irssi before, but I found referencing this guide to using Irssi and screen invaluable. I used the following settings to automatically generate logs without the noisy join/leave messages and to auto-create a different log file for each channel and day.


"fe-common/core" = {
autolog_path = "/root/irclogs/$tag/$0.%Y-%m-%d.log";
autolog = "yes";
autolog_level = "all -crap -clientcrap -ctcps -joins -parts -quits -nicks";
};

So now I had text logs being output. But they still looked ugly when viewed in a browser, so they needed to be html-ified. Enter irc2html.pl (yes a perl script). Feed it a log file and it outputs a nice-looking html page. I ran into some issues with that script where large sections of text would have a black background (making them unreadable unless highlighted with the mouse), so I commented out a few lines which seems to have fixed the issue. You can get my version of the script here.

I then created a simply bash script that would check for any irc log files modified in the last 5 minutes and run the perl script on them, dumping the html output in a different directory (get it here). Then it was just a matter of adding a crontab entry to run this this script every 5 minutes.

To easily remotely access these logs, I set up lighttpd on the NAS, sharing the html output directory. (lighttpd was incredibly easy to setup, I highly recommend it for other simple projects like this!). Now any computer on my LAN can browse to the server and easily browse and read all of the logs.

This whole project was definitely more work than I intended it to be, but the resulting setup is perfectly tailored to me. I can comfortably browse the IRC logs at my leisure from any computer on my LAN, and if I want to start talking in the conversation, I can fairly easily ssh into my NAS and talk in Irssi. (My next blog post will likely be on remotely accessing the logs using SSH port forwarding, fun stuff!)

As a side note, please do not post the logs online for others to view (i.e. publicly log) without consent from the channel admin. (See the IRSeek incident)