PDA

View Full Version : Logging


Dignity
17/06/2017, 09:56 PM
Hey guys.

What do you guys think (as server owners) are the most essential parts to log?

I've literally been logging everything as Limex (ex owner of True Roleplay) once told me that you can't have enough logs.

Would love to hear some thoughts, and maybe instigate a discussion about what the best functions or things to log are

Vince
17/06/2017, 10:56 PM
Store everything that you can conceivably use to make reports and graphs. Don't store "counts" of things, store the things that affect those counts. So don't store things like "number of guns bought". You want to know when, where, which gun, how much ammo, ...

Timestamps are important. You want that time dimension. You could conceivably also store a "space" dimension but how useful that would be largely depends on the kind of server.

I used to store every single kill/death in SQL. This table would get very large rather quickly but it gave me the ability to create detailed reports such as what a player's most effective/favorite was or what weapon was most effectively used against a player. No kill or death count was stored separately, everything was counted on the fly when needed. It also provided the possibility to create a K/D ratio on a day-by-day basis which could then be visualized on a graph to show improvement (or lack thereof). It was even possible to throw the "weapon" dimension into the mix as well to show the improvement per weapon.

I also used to store every single monetary transaction as a new row, as opposed to just storing "money" in the player's account. This meant that I could very finely track the economy and the origin and the destination of the money. The "transaction" table was made up of five columns: senderid, recipientid, amount, timestamp and comment. Amount could be positive or negative to denote credit or debit and total money in the account was calculated by calculating the sum over all the amounts. For example:

+3000 start credit
-500 purchase stuff
+100 job payout
-400 purchase other stuff

total: (3000) + (-500) + (100) + (-400) = 2200
Here too, transactions could be summed over a period of time and/or grouped by credit/debit to visualize spending habits.

So many possibilities.

kubak01
12/07/2017, 04:31 PM
We use simple text files for logging, and we basically log everything that a player does.

When our MySQL DB crashed and we had no backup other than a 4 days old one we just wrote a simple C# program using regular expressions to parse the logs and generate SQL queries to get it all back. Everything was back at it's place.

Paulice
12/07/2017, 05:00 PM
We use simple text files for logging, and we basically log everything that a player does.

When our MySQL DB crashed and we had no backup other than a 4 days old one we just wrote a simple C# program using regular expressions to parse the logs and generate SQL queries to get it all back. Everything was back at it's place.

As for everything you mean:
- score
- kills
- admin level change
- money change
- account registration
- etc.?

It must have felt satisfying restoring the database that way, props.

kubak01
20/07/2017, 09:41 PM
Aye it was.

https://github.com/Mrucznik/LogMaster

Thanks man!