/*
   File:        /usr/lib/rsyslog/alterDB_addon_LogAnalyzer.sql
   Last update: $Id$

   alter table SystemEvents / SystemEvents:
         modify tables ProcessID and SystemEvents
         for use of  LogAnalyzer

*/

ALTER TABLE SystemEvents ADD COLUMN `Checksum` int(11) unsigned
  NOT NULL DEFAULT '0' AFTER `SystemID`;

CREATE INDEX FromHost           USING BTREE ON SystemEvents(FromHost);
CREATE INDEX Checksum           USING BTREE ON SystemEvents(Checksum);
CREATE INDEX DevicereportedTime USING BTREE ON SystemEvents(DeviceReportedTime);
CREATE INDEX EventID            USING BTREE on SystemEvents(EventID);
CREATE INDEX InfoUnitID         USING BTREE on SystemEvents(InfoUnitID);

delimiter //
CREATE TRIGGER syslog_systemevents_message BEFORE INSERT ON `SystemEvents`
                                           FOR EACH ROW
                                           BEGIN
                                             SET NEW.Checksum = crc32(NEW.Message);
                                           END;//
delimiter ;
