superseriousstats is a fast and efficient program to create statistics out of various types of IRC chat logs.
- Cleanly written in PHP8 using strict typing (source).
- Incremental processing of logs, progress is stored in an SQLite database.
- Generates a static HTML page without dependencies or embedded scripts.
- Optional dynamic pages for historical and user stats.
- Tiny configuration file with as little as three required settings.
Get the latest stable source:
$ git clone --depth 1 --branch stable https://github.com/tommyrot/superseriousstats.git
Go down the checklist:
Install the latest version of SQLite3.
Install PHP8 CLI (Command Line Interface) and a webserver along with PHP8 FPM (FastCGI Process Manager). Confirm that both PHP8 CLI and FPM have the mbstring and sqlite3 modules compiled in.
If you plan on parsing gzipped logs then PHP8 CLI must have the zlib module compiled in as well.
Available logfile parsers can be found in the superseriousstats/parsers/ directory. Currently the following formats are supported: catgirl, eggdrop, hexchat (xchat), irssi (smuxi), limechat, mirc, nodelog, supybot, textual, thelounge, weechat, znc (muh2). Put the appropriate parser name in the config file during step 6 below.
Note that all logfiles must be written as one file per day and must have a date in their filename; either 'Ymd' or 'Y-m-d'. Additionally, each channel must be logged to a separate directory. Lastly, all parseable lines and events must be prefixed by a 24-hour clock timestamp.
For example: ~/irclogs/my_channel/#my_channel.1999-12-31.log.
Set up an empty database for your channel:
$ cat sqlite_schema.sql | sqlite3 /path/to/www/databases/my_channel.db
Create a directory for your webserver to serve stats from and copy the necessary files to it:
$ cp banner* common* favicon.svg history.php sss.css user.php web.php /path/to/www/my_channel
In the destination directory edit web.php and change the string %CHANGEME% to the location of the database you created during step 4 earlier. (NB: the location should be relative to the chroot jail your webserver operates in, if applicable).
Finally, go over sss.conf and you're all set!
The easiest way to keep your stats up to date is to make a cron job:
$ crontab -e
@hourly /usr/local/bin/php /path/to/superseriousstats/sss.php -qi /path/to/irclogs/my_channel/ \
For all options refer to the manual.
Bugs, Features and Discussion
Join us on IRC in #superseriousstats on irc.libera.chat:6697 TLS. All project related chat is welcome there. Please notify me of any bugs you may stumble upon! Given enough details i usually have a fix out shortly.
Supporting the Project
I started this project back in 2002 as a fun way to give some insight into the chat patterns of me and my friends on IRC. Over the years it has evolved from a single static page to a dynamic piece of art ;-) containing user profiles and a browsable history. The source is available so others can enjoy it as they like. The project isn't finished. I'm always connected to IRC and there are still ideas floating around on my TODO.
Meanwhile, have fun with superseriousstats and give it a star over at GitHub if you could. Support by means of a donation is also very much appreciated and can be done via Bitcoin to the following address: 14Nd9sTUfQ88SfsazL5GJ99JjtaKGpS2Kx.
Frequently Asked Questions
How do i link different nicks to a single user?
By default nicks are automatically linked in a simple manner that should result in minimal false positives. This behavior can be disabled in the config file by setting auto_link_nicks = "false". To manually alter user relations, first create an export of all existing ones with sss.php -e <file>. This file can then be edited and imported back into the database.
Here is some example output with all nicks superseriousstats found and linked for a fictional channel:
The first value in each comma separated list is the user status, it can be either; 1 = registered, 3 = bot, 4 = excluded, * = unlinked. All nicks on the same line belong to the same user. First in the list is the nick with the most lines typed. It will be the user's main nick, they will be referred to by this particular nick in the stats. All ensuing nicks are considered aliases of that user.
The nick with the most lines typed will always automatically become the main nick for a user, on every stats update. This behaviour cannot be changed.
Let's say you want to change a user into a bot. Just change the 1 into a 3. If you want Bobzzz and PartyBob to become aliases of Bob, put these nicks on the same line as Bob. Easy. To exclude certain nicks, like SPAMGUY, put their nick on a seperate line prefixed with a 4. We now have:
Save your changes and run sss.php -m <file> to import them. The line(s) beginning with an asterisk will be ignored so don't worry about those.
Be aware that wildcards will not work in this file and made-up nicks will not be recognized either. If you plan to manually take control of user relations it is strongly advised to backup your efforts!
Can users have avatars?
Yes, on their profile page (user.php). First create a directory on your webserver:
$ mkdir /path/to/www/my_channel/userpics
Put any avatars in this directory and name them exactly as one of the aliases of the user they belong to. The extension can be one of; bmp, gif, jpg, jpeg, png and svg. Avatars are displayed with a 80x80 pixel dimension so for optimal scaling use a 1:1 aspect ratio for them.
In order to display a picture for users who don't have an avatar in aforementioned directory, use the userpics_default setting in your config file.
What is TLD validation?
As you might have noticed there is a file called tlds-alpha-by-domain.txt in the repository. This is a database of all valid TLDs (Top Level Domains) on the internet. By default superseriousstats flags all URLs with an invalid TLD as inactive so they won't show up in the stats. These hyperlinks normally lead nowhere so there is no point to include them.
To disable this behaviour just delete the file and superseriousstats will skip the validation and unflag all existing URLs.
If you want to keep the TLD database up to date here is an easy way:
$ crontab -e
@weekly /usr/local/bin/curl -s http://data.iana.org/TLD/tlds-alpha-by-domain.txt
My channel was logged by different clients in the past, problem?
This is not a problem. Take into account that logs must always be parsed in chronological order.
Working from oldest to newest, put all continuous logs with the same syntax in a separate directory. Edit your config file and set the correct parser for this batch. Now parse all logs in that directory. Next, edit your config file again and set the parser for the following set of logs. Parse the appropriate directory. Repeat this procedure as many times as necessary.
I have just one big log, now what?
Sorry, you will have to find a way to split it into separate per day logfiles yourself..
The syntax of my logs is not recognized?
The parsers that come with superseriousstats are made to work with the default logging syntax of each supported IRC client. When you customize your client, with a theme for instance, it sometimes causes the logging syntax to change as well and the parser won't recognize it anymore. This obviously is out of my control and therefore not supported. In other cases we might be facing a bug and i'll happily take a look if you tell me about it on IRC.
What is the recommended procedure for upgrading?
Make sure you have all your chat logs at hand and decide if you want to make an export of the user relations for the channel. Delete the current database and redo step 4 & 5 of the installation checklist. Now parse all logs like you would normally do and import the user relations if you made a backup earlier. Done.