Server logs

Started by
1 comment, last by Luke251 13 years, 1 month ago
atm I'm only logging the ip addresses that connect to my server but I'm thinking about removing that since I don't have much use for that. Maybe I will remove the server logging all together. I don't have much experience of running game servers but I'm making a MMO server for a 2D game.

Anyway, the question for you guys is... What are your thoughts about what should be saved to a log file for a MMO game?

Thanks.
Advertisement
What is logging for?

Managing load: You should log CPU load, memory load, disk load, disk usage and network load, at least once a minute, into something like rrdtool or cacti or whatever. This will allow you to chart system performance over time.

Managing players: You should log application-level events that are important. Player X connected. (from where?) Player X disconnected. Player X gained a level. Player X died. Perhaps Player X killed monster Y. Perhaps the contents of each trade operation. This will make it easier for you to investigate reports of your players. You *don't* want to log state that changes all the time, like position, or stats. Only things that really affect the game, and may be helpful when players claim "I killed X and it dropped Y but then the server crashed and now it's not in my inventory."

Managing development: You should log system-level events that are important. Threads created. Memory availability, per allocated type. Operations that take longer than expected. Errors from other subsystems. And, importantly, any crashes -- make sure you get core dumps, stack traces, and these get stored somewhere together with the version of the source that was running, so you can debug them. You should probably capture crashes from the clients, too, and upload them to a system where you can track them. (Beware of privacy: you may want to scrub the crash dumps of any user identifiable information)

The key is to log to a system that lets you actually take advantage of the log information. Plot the occurrence of various events over time. Send warning e-mails if disk free or memory free or CPU available drops below certain limits. Have a database that lets you search for various terms (subsystems, users, IP addresses, times of day, etc) to look for information about problems you're investigating.

Yes, logging will use gigabytes of storage, but that's a small price to pay for being able to actually understand what your service is doing!


enum Bool { True, False, FileNotFound };

Anyway, the question for you guys is... What are your thoughts about what should be saved to a log file for a MMO game?


Short answer, you need everything. :)
Logs help you deduce what went wrong or what someone was doing when something went wrong. So keep a log things like these, you will also need the time these events took place and which server sub-system logged the item:
Successful login attempts, with IP
Failed login attempts, with IP
Chat text
Private messages
Items bought, sold, removed from auction
Items looted
Monsters killed
Periodtic server CPU load, network bandwidth

An important thing to remember is to store these logs on fast storage in a way that can be browsed and where items can be filtered based on the log type or other factors.

This topic is closed to new replies.

Advertisement