delimiter //
create trigger tr_syslog
before insert on logs
for each row
begin
IF (NEW.host = '10.1.12.218') THEN
INSERT INTO cisco_wlc (host,facility,priority,level,tag,datetime,program,msg,seq) VALUES (NEW.host,NEW.facility,NEW.priority,NEW.level,NEW.tag,NEW.datetime,NEW.program,NEW.msg,NEW.seq);
DELETE FROM logs WHERE seq=NEW.seq LIMIT 1;
END if;
IF (NEW.host='10.1.12.99') THEN
INSERT INTO windows_eventlog (host,facility,priority,level,tag,datetime,program,msg,seq) VALUES (NEW.host,NEW.facility,NEW.priority,NEW.level,NEW.tag,NEW.datetime,NEW.program,NEW.msg,NEW.seq);
DELETE FROM logs WHERE seq=NEW.seq LIMIT 1;
END if;
IF (NEW.host='10.1.12.23') THEN
INSERT INTO mikrotik (host,facility,priority,level,tag,datetime,program,msg,seq) VALUES (NEW.host,NEW.facility,NEW.priority,NEW.level,NEW.tag,NEW.datetime,NEW.program,NEW.msg,NEW.seq);
DELETE FROM logs WHERE seq=NEW.seq LIMIT 1;
END if;
IF (NEW.host='10.1.12.17') THEN
INSERT INTO vmhost2 (host,facility,priority,level,tag,datetime,program,msg,seq) VALUES (NEW.host,NEW.facility,NEW.priority,NEW.level,NEW.tag,NEW.datetime,NEW.program,NEW.msg,NEW.seq);
DELETE FROM logs WHERE seq=NEW.seq LIMIT 1;
END if;
end;
//