EvilLogBot – Python IRC channel logger

This is my latest project which I, for most part, finished. Its purpose is to log everything that happens user-related in an IRC channel to a configured database. Initially this was made to be used with PISG (the irc log file parser and stats generator) on an EvilZone network (your mileage may vary) and it was for some time. But now EZ has transitioned into new era and it needed to be re-designed. So this is the final product which can be found on my github:
This bot is very simple, it takes no user input through IRC and gives no output on IRC, ignores all queries – it only logs user actions, like PING timeout, kick, ban, join, part, etc. It has however some features – ignore (to ignore certain nicknames) and logrotate (to delete logs older than defined days and keep your DB clean).
Before using it you must configure to your own needs, and it’s done simply.

It consists of 2 modules – for SQLite and MySQL. You can make your own by copying the file and replacing methods with whatever DB API you use. Within each module there’s a DB config and within the main file there is the bot config. DB config is straightforward, so I’m not gonna explain that. Bot config is like this:

configs = {
    "server": "",
    "channel": "#test",
    "port": 6667,
    "name": "NewStatsBot",
    "log_name": "evilzone_logs.txt",
    # let's use zbot's format, easiest format to deal with :)
    "time_format": "%m/%d/%y %H:%M:%S",
    "log_age": 1 # in days

Server is where to connect, channel is where to log, port is default (doesn’t support SSL probably :P), name is the bot’s name, log_name is where to export the logs for PISG (or some other parser) to process, time_format is set to zbot’s – because it’s most easiest to handle and it’s a setting in PISG.
Now the final log_age is where it’s at – set it how much (in days) logs do you want to keep, current setting is to keep 1 day +1 day just in case, this varies with channel activity, but for EZ 60 days is optimal.
Log rotation was done to keep PISG from messing up, because of frequent nick changes or trolling, if PISG had to process a half year of logs it’d be a mess – some lines would get assigned to wrong names, some names would disappear… but with this there would always only be last 60 days of logs, so eventually all crap would fade away.

Notify of

Newest Most Voted
Inline Feedbacks
View all comments