Logging and statistics

As most of our players will know, we keep a log of activity on our Public Server. Few however know how it works, what is being stored and what we do with it. That’s why this blog will explain the basics of our logging functionality and what that means for openttdcoop and its players.

Example of a logfile.


The rule on our servers is you sign your own work. This way we can see who’s done what. But it’s not a foolproof system, as players with bad intentions will most likely not sign their destruction, or respond to inquiries of other players. Because of this, admins had to guess who was responsible for such actions, which generally resulted in kicking the player who was the least known. Obviously this is not a fail-safe solution.

To combat this problem our server runs with a custom-written patch. This patch outputs certain game information to a logfile, one file for each game. Firstly it logs information from the server itself. Think of error reports, leaving and joining players, game status and password changes. Secondly it logs all the actions by the players, with their respective price tags and parameters like game tiles. And thirdly all in game chat is also logged. With this information we can accurately determine the culprit, ban him and then reload the game from an autosave to undo any bad changes. This way we are pretty much covered against any sort of in game mishap.


Now you could consider me a privacy nut, I’m apparently one of the few who thinks it’s important and shouldn’t be given up so easily as it has been in the previous years. With that in mind I’d like to highlight the privacy side of this situation to calm the uneasy feeling you might get of the idea of being watched in game.

While we are logging everything that goes on in-game, only members, players that have shown to be trustworthy, get access to the log files. And they are not staring at it all the time either, because frankly, there are better things to do then stare at up to 20 Megabytes of text. The way the log is used is that we browse it with a tool whenever we notice bad behaviour on the server. This tool looks at the last X lines in the log, highlighting actions that could be the bad behaviour we are looking for. Think of the levelling of land, actions with huge price-tags and demolitions. This saves us the work of actually having to search for these things ourselves. Basically, we don’t look at the building in progress, we only search for abuse when it’s needed. Last but not least, logs will be deleted after a while. Generally we keep around 5-10 games worth of logs and the rest is discarded.


The majority of our playerbase comes with a background in exact sciences, like me. With this in mind, I thought it would be a good idea to generate statistics from our logfiles. Because who doesn’t like statistics? So more then half a year ago I decided to write a program in Java that parses those log files and generates statistics out of them, like the number of lines typed and money spent.

Generated statistics.

The program is now hosted on our own Dev server. After a long time of neglecting it’s maintenance, a rewrite to compensate in a change of style and the fixing of some bad bugs, the program is finally up-to-date and all logs excluding the current one are processed. The results of this can be found here. And no, this is not useful. But it’s always interesting to have a look.

Future work

Right now I am working on a system that plots the tile information of actions into an image. Combined with some image processing, it should be possible to build a mini-mini-map, not based on how it looks, but based on how much has changed. This is an example of how such a map could look like:

An activitymap.

I wonder if anyone can guess the game number from that image. But once again, not useful, but probably interesting to see. Besides that there is some work to be done on the usability of the program itself and adapting it for use on other servers as well. If you have any more ideas, comments or suggestions, feel free to post your them in the comments or let me know on IRC.

8 comments so far

  1. V453000 April 11, 2010 15:15

    Very nice article πŸ™‚ But what the hell is the first image! πŸ˜€ πŸ˜›

  2. frosch April 11, 2010 15:41

    To identify bad/good guys you could also colour the mini-mini-map according to the last user who modified a tile.

  3. Radicalimero April 11, 2010 17:34

    nice article. I can guess the game number, it’s 147. The first openttdcoop game i played.

  4. MrRuben5 April 13, 2010 02:15

    Very nice! I also like how the statistics file keeps info on slaps etc. (most hated person ^^). Looking forward to see the activitymap.

  5. bofh April 13, 2010 10:27

    Privacy nut and not blurring the IPs of the connected users? Tsk tsk πŸ˜‰

    And yes, an activity map sounds really cool!

  6. Ammler April 13, 2010 11:27

    That is the point about logging, why should we mask the IPs?

    (The users of the example are members and are aware of it, I guess, those even are changed too.)

    If you care about IP and privacy, please use Tor.

  7. ODM April 13, 2010 19:23

    Thanks for the replies. It was indeed game 147, well spotted. That’s when i first started working on the map thingy.

    About the IP’s: I changed them. I could’ve blurred them out, but that wouldve spoiled the image. Also, what Ammler says, IP’s arent hard to come around really.

  8. planetmaker April 14, 2010 11:30

    Nice summary article. And indeed these logging things made administration in case of disputes / grievers so much easier. And the summaries for games are an interesting feat πŸ™‚

    Privacy is not a concern as we don’t publish private information (those screenshots show what is unavailable to the general public, only digests will be made available)

Leave a comment

Please be polite and on topic. Your email-address will never be published.