Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
makam0.9_SOURCE.zip | 2011-03-14 | 21.3 kB | |
Makam0.9.zip | 2011-03-14 | 8.3 MB | |
Totals: 2 Items | 8.3 MB | 0 |
/** * MAKAM * * @author shaun.dunmall * @version 0.9.1 * * What does MAKAM do? * It provides a way of logging an arbitrary event to a MySQL database by * machine name, machine IP, MAC address and username. * * How do I use it? * In one of two ways, both command line : * 1) java -jar makam.jar \\somepath\dbconfig.cfg "my event" * Where "my event" is the text describing the event you wish to log, for example * "Machine Starting" or "User Logging on"; and dbconfig.cfg is a simple text * configuration file that holds the database details thus: * HOST hostname Mandatory - The hostname of the MySQL Database machine * DB databasename Mandatory - The Database name * TABLE tablename Mandatory - The Table name * USER username Mandatory - The MySQL username * PASS password Mandatory - The MySQL password * FIELD-USER username Optional - The name of the DB field for the user name * FIELD-IP ipaddress Optional - The name of the DB field for the ip address * FIELD-MAC macaddress Optional - The name of the DB field for the mac address * FIELD-NETBIOS machinename Optional - The name of the DB field for the machine name * FIELD-TIMESTAMP timestamp Optional - The name of the DB field for the timestamp * FIELD-EVENT event Optional - The name of the DB field for the event * * Note: Not case sensitive. * Everything after the second word is ignored. * White-space delimited. * Blank lines are ignored. * Lines starting with ; \ / or ' are ignored. * * * 2) java -jar makam.jar hostname databasename tablename username password "my event" * * Uses default field names of : * username, ipaddress, macaddress, machinename, timestamp and event. * * * * SQL Configuration : * Setup the fields as VARCHAR(30) to get going then you can optimise them * down later. The field names are defaulted as above or set to whatever * you want from the config file. I'd suggest an auto incrementing primary field * of some sort too, call it ID or something (but do not call it INDEX). * Makam does not create the database table, you must do that first yourself. * The database user only needs to be able to write to the table, * not read or drop or anything. * * This should help you create an `events` table in your `makam` database : DROP TABLE IF EXISTS `makam`.`events`; CREATE TABLE `makam`.`events` ( `id` int(11) NOT NULL auto_increment, `UserName` varchar(20) NOT NULL, `HostName` varchar(15) NOT NULL, `IPaddress` varchar(15) NOT NULL, `MACaddress` varchar(18) NOT NULL, `event` varchar(30) NOT NULL, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY USING BTREE (`id`), KEY `MACaddress` (`MACaddress`), KEY `UserName` (`UserName`), KEY `HostName` (`HostName`), KEY `IPaddress` (`IPaddress`) ) ENGINE=MyISAM AUTO_INCREMENT=4297 DEFAULT CHARSET=utf8; * * * * Why? * Put some makam calls in appropriate places, like login/logout scripts, * startup scripts, shutdown scripts etc * Provides you with a nice easy way to cross-reference which machines and or * users logged in or out and when. Or whatever other purpose you find useful * to log. * * --------------------------------------------------------------------------- * * Features to add * --------------- * * 1) Log Machine Serial number as well (Dell Tag#) * * * * Changelog * --------- * 0.9.1 - Removed some diagnostic print statements. * Made the timestamp a SQL timestamp rather than Java. * * 0.9.0 - First Release * * */