sLog v0.8 copyright (c) 2008 Kjell-Inge Gustafsson, kigkonsult www.kigkonsult.se/slog slog@kigkonsult.se DESCRIPTION =========== A mysql (5.x) log database able to log events in a single or multi system/application environment. Written completely as mysql stored procedures with a secure simple log interface using direct access to database or via a web/soap service. sLog logs application and system events, keeping track of user, client, application, application module, operation, date and time and event/log specifics. Logging can be done with a simple direct mysql (function) call, no coding required apart from coding database connection and call. Logging can also be done by doing http or SOAP requests, PHP examples attached. Database structure is completely hidden from user/calling application, using a mysql user only allowed to insert log events by executing a stored procedure. Only sLog mysql administrator can access stored events and gather statistics of user activities (who did what, when?) and application use and payload. LOG ITEMS ========= ORGANISATION organisation/unit alt. internet country name/code Type and size: string <= 255 characters mandatory=yes ORGANISATION_SPEC organisation/unit detail text Only if ORGANISATION is used Type and size: string <= 255 characters mandatory=no USER Some user id, member id alt. IP-number Type and size: string <= 255 characters mandatory=yes USER_SPEC ex. user name alt. Internet domain Only if USER id used Type and size: string <= 255 characters mandatory=no CLIENT client name, alt. Web browser. Type and size: string <= 255 characters mandatory=yes CLIENT_SPEC client specification:version.. ., alt. Web browser spec. Only if CLIENT is used Type and size: string <= 255 characters mandatory=no APPLICATION application/system name Type and size: string <= 255 characters, stored in lower case mandatory=yes SERVICE application/system module/(web-)service name ex. 'createCustomer' Type and size: string <= 255 characters, stored in lower case mandatory=no, default application/system name OPERATION Basic operation, ex. CRUD; one of 'create'/'read'/'update'/'delete' Type and size: string <= 6 characters, stored in lower case mandatory=no OBJECT NUMBER Used if running more than one instance of the object (=application/service), ex. together with a load balancer Type and size: integer mandatory=no, default 1 DATE event date Type and size: string, format 'Y-m-d' mandatory=no, log date used if missing TIME event time Type and size: string, format 'H:m:s' mandatory=no, log time used if missing SUBJECT Detailed header event information like query, read/update/delete id.. . Type and size: string <= 255 characters mandatory=no BODY Respons, query answer, update specific.. Type and size: string <= 2^16 characters mandatory=no INSTALL ======= Unpack to any folder. Open createDB.sql in an editor and CHANGE and notice passwords (and opt. hosts, if running in a multi server environment) for slogadmin, slogreader and slogcaller!!! User slogadmin is used when managing slog database. User slogcaller is used when insert log events into database, no access right except executing stored procedures. User slogreader can only read database, used with sLog Payload Monitor (separate download). Observe character set for database and change it if not appropriate. Within the installation folder, open up a terminal window and log into mysql as mysql root user -->mysql -u root Set delimiter mysql>delimiter // Run the createDB.sql script mysql>source createDB.sql Select the new database slog mysql>use slog Create the tables mysql>source createTables.sql Create the mysql stored procedures mysql>source createProcedure.sql Exit mysql mysql>exit All operations can also be done with an mysql admin interface like phpMyAdmin. If using phpMyAdmin and import script function, use delimiter '//' (no quotes) when running createProcedures.sql. Apply a sLog call into every application(/module/service). Thats'all! FILE LIST ========= db/ test folder, testing direct db access db/slogtest.php slog direct database access test form http/ test folder, testing http access http/insertLog.php http test server, using PHP PEAR HTTP_Rrequest http/slogtest.php http test client include/form.php common functions, used in test pear_soap/ test folder, testing SOAP access, PHP PEAR SOAP pear_soap/slogclient.php SOAP test client pear_soap/slogserver.php SOAP test server pear_soap/slogserver.class.php SOAP test server class, user by server pear_soap/slogserver.wsdl SOAP WSDL (Web Service Definition Language) file scripts/ sql scripts scripts/createDB.sql create database+user script scripts/createTables.sql create table script scripts/createProcedures.sql create stored procedures and functions scripts/dropTables.sql drop/truncate tables GPL.txt licence howto.txt PHP samples howto assemble web related log items README.txt this file USAGE EXAMPLES ============== ## Direct database ## The logging application is making an insert direct into the database. Files: - db/slogtest.php, slog test form A PHP 5.x example: $link = mysql_connect( , , ); mysql_select_db( ); // = 'slog' // COMPLETE call: mysql_query("SELECT .fslog('','