View Single Post
Author Message
recon0
Veteran Member
Join Date: Sep 2007
Location: US
Old 04-11-2009 , 17:35   Source Logging and Reporting Services
Reply With Quote #1

Updates

Latest SLRD version 1.2.0.0, released 6/6/2009.

Latest SLRP version 1.0.2.0, 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 (<) - &lt;
greater than (>) - &gt;

Source for the above escape sequences.



Background


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.

Concept

SLRS has three major pieces:
  1. SLRD - Source Logging and Reporting Daemon
  2. SLRP - Source Logging and Reporting Plugin
  3. 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.

Screenshots

DB Schema

Click image for larger version

Name:	diagram.JPG
Views:	2100
Size:	45.4 KB
ID:	40608

tblLogMessages

Click image for larger version

Name:	sneakpeaksrls.jpg
Views:	2164
Size:	98.4 KB
ID:	40609


Requirements
  1. An administrator who knows how to manage and configure MySQL and SourceMod
  2. A MySQL database
  3. A server to run the daemon on
    1. The server must have the Microsoft .NET Framework 2.0 installed
  4. A game server running SourceMod 1.2 or later


Installing SLRS

This system is somewhat complex, and requires some technical skills to install it.

Setting up the database
  1. Create the database "sourceloggingdaemon" with the attached db.sql.txt file
  2. Create a DB account for the the clients to use
    1. This account needs to have access from the machine running SLRD and all game servers running SLRP

Installing the daemon (SLRD)
  1. Extract the SLRD.zip file to a directory on the server where you want to run the daemon
  2. Set the correct database details in the daemon's SourceLoggingDaemon.exe.config file
  3. Start the SLRD using the following syntax
    1. sourceloggingdaemon.exe -ip listenIPHere -port listenPortHere
  4. 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)
  1. Add the server's IP and Port to the tblSources table. Note the auto-generated SID. You will need it later.
    1. Each server should have it's own row
    2. You have to restart SLRD if you make changes to tblSources so it loads the new version of the table
  2. Add the below line to your server.cfg
    1. log on
  3. 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
    1. logaddress_add listenIPHere:listenPortHere
  4. Download the SLRP.zip package and extract to modfolder/addons
  5. Configure a slrs entry in databases.cfg to point to your SLRS database
  6. 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)
  7. Load the slrp plugin


How to use

All log messages are in tblLogMessages. Use SQL to search the table.


Changelogs

SRLD
  • 1.0.0.0
    • Initial Release
  • 1.0.0.1
    • Bug Fix - Fixed null reference exception caused by LogMessage.GetPlayerInfo
  • 1.0.0.2
    • Bug Fix - Safer log parsing
  • 1.0.0.3
    • Bug Fix - Relaxed targeted Regex
    • Bug Fix - Team names can have spaces
  • 1.0.0.4
    • Other - Ensured the proper connection string is used
    • Bug Fix - Adjusted connection string to properly handle UTF8 strings
  • 1.1.0.0
    • Other - UTF insanity resolved
  • 1.1.0.1
    • Bug Fix - Date time parsing region bug (now using ParseExact)
  • 1.2.0.0
    • Feature - Multiple game servers on the same IP address can now stream logs to SLRD
  • Next item
SLRP
  • 1.0.0.0
    • Initial Release
  • 1.0.1.0
    • Feature - Timestamps are now set correctly for sources that aren't in the DB server's time zone
  • 1.0.2.0
    • Feature - Timestamps are now based on the SourceMod current time
  • Next item


Troubleshooting

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.


Thanks to
  • 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
Attached Files
File Type: zip SLRP.zip (8.5 KB, 519 views)
File Type: sp Get Plugin or Get Source (slrp.sp - 1569 views - 8.4 KB)
File Type: txt update_utf8.sql.txt (881 Bytes, 521 views)
File Type: zip SLRD.zip (163.0 KB, 468 views)
File Type: txt add_messagedt_index.sql.txt (412 Bytes, 545 views)
File Type: txt db.sql.txt (1.7 KB, 504 views)
__________________

Last edited by recon0; 12-26-2013 at 20:49.
recon0 is offline