Latest SLRD version 126.96.36.199, released 6/6/2009.
Latest SLRP version 188.8.131.52, released 4/16/2009.
Note: special characters in DB passwords
If you use certain special characters in your DB password, they must be escaped in the exe.config file. Here are the characters and their escaped versions:
quote (") - "
apostrophe (') - '
ampersand (&) - &
less than (<) - <
greater than (>) - >
Source for the above escape sequences.
Before SLRS, I wrote several other logging systems/readers, and though they worked to a certain degree, they weren't powerful enough. SLRS came about when I noticed some new functions in the API about GameLogHooks. Though I didn't end up using them, the discussion lead to a comment by Tsunami, in which he suggested creating a daemon that can receive a logaddress stream, which is how SLRS works.
SLRS has three major pieces:
- SLRD - Source Logging and Reporting Daemon
- SLRP - Source Logging and Reporting Plugin
- A MySQL Database
SLRD is responsible for processing log streams from multiple sources. (A server that sends a log stream to SLRD is considered a "source".) The daemon sends everything that you'll see in your standard SRCDS log files (modfolder/logs) to the database.
SLRP logs all SourceMod LogAction messages to the database.
With this system in place, your SM admin and server logs are stored in an easily searchable DB table.
- An administrator who knows how to manage and configure MySQL and SourceMod
- A MySQL database
- A server to run the daemon on
- The server must have the Microsoft .NET Framework 2.0 installed
- A game server running SourceMod 1.2 or later
This system is somewhat complex, and requires some technical skills to install it.
Setting up the database
Installing the daemon (SLRD)
- Create the database "sourceloggingdaemon" with the attached db.sql.txt file
- Create a DB account for the the clients to use
- This account needs to have access from the machine running SLRD and all game servers running SLRP
- Extract the SLRD.zip file to a directory on the server where you want to run the daemon
- Set the correct database details in the daemon's SourceLoggingDaemon.exe.config file
- Start the SLRD using the following syntax
- sourceloggingdaemon.exe -ip listenIPHere -port listenPortHere
- If the server you are running SLRD on has a firewall, you will need to add sourceloggingdaemon.exe or listenIP:listenPort (on some firewalls, just the listen port) to the firewall's exception list
At this point, the logging daemon is online and ready to receive log messages.
Attaching servers and installing SLRP
(repeat these steps for each server you want to attach)
How to use
- Add the server's IP and Port to the tblSources table. Note the auto-generated SID. You will need it later.
- Each server should have it's own row
- You have to restart SLRD if you make changes to tblSources so it loads the new version of the table
- Add the below line to your server.cfg
- log on
- Add the daemon's listen IP/Port to the logaddress list for each server that you want to stream logs from by adding the below statement to your server.cfg
- logaddress_add listenIPHere:listenPortHere
- Download the SLRP.zip package and extract to modfolder/addons
- Configure a slrs entry in databases.cfg to point to your SLRS database
- Edit sourcemod/configs/slrp/settings.cfg and adjust for your source (set the SID to the SID for this source; you can obtain the SID from the tblSources table)
- Load the slrp plugin
All log messages are in tblLogMessages. Use SQL to search the table.
- Bug Fix - Fixed null reference exception caused by LogMessage.GetPlayerInfo
- Bug Fix - Safer log parsing
- Bug Fix - Relaxed targeted Regex
- Bug Fix - Team names can have spaces
- Other - Ensured the proper connection string is used
- Bug Fix - Adjusted connection string to properly handle UTF8 strings
- Other - UTF insanity resolved
- Bug Fix - Date time parsing region bug (now using ParseExact)
- Feature - Multiple game servers on the same IP address can now stream logs to SLRD
- Next item
- Feature - Timestamps are now set correctly for sources that aren't in the DB server's time zone
- Feature - Timestamps are now based on the SourceMod current time
- Next item
If SLRD closes shortly after you start it, or if log messages aren't making it into the database, you can check the SRLD logs. The logs are created by default at ./logs.
Licensing & Source Code
SLRS is licensed under the GNU GPL 3.0 license. You can download the source code (if you don't know what source code means, you are trying to download the wrong thing) from GitHub
- DJ Tsnuami - For giving me the idea to write this
- devicenull - For pushing me to parse out more information from the log lines
- -₪EPIC₪- Trickster |CiC.| - For triggering the MySQL UTF bug
- XAMPP - For an awesome developer's tool