MYSQL trigger Áú¹®ÀÌ ÀÖ½À´Ï´Ù..

   Á¶È¸ 5544   Ãßõ 0    

mikrotik 에서 패킷 스니퍼 기능으로 ubuntu 16.04 서버에 패킷을 보낸후 suricata로 분석하고 barnyard2 로 db에 저장

db에 저장된 값을 php 스크립트를 이용하여 미크로틱 api기능을이용해서 블럭 어드레스에 추가하는 기능입니다.. 다른것은 다 진행되는데 mysql 트리거 에서 문법오류가 납니다 ㅠㅠ

확인 가능하신분 계시면 확인부탁드립니다..

 http://forum.mikrotik.com/viewtopic.php?t=111727


CREATE TRIGGER `after_iphdr_insert` AFTER INSERT ON `iphdr`
  FOR EACH ROW BEGIN
  DECLARE this_event INT(11) default 0;
  DECLARE this_event_signature INT(10) default 0;
  DECLARE this_event_timestamp TIMESTAMP;
  DECLARE this_sig INT(10) default 0;
  DECLARE this_sig_name VARCHAR(256) default "";
  DECLARE this_sig_gid INT(10) default 0;
  DECLARE timeout VARCHAR(12) default "";
  DECLARE interested INT default 0;
  DECLARE direction VARCHAR(3) default "";
  DECLARE ip_src VARCHAR(64) default "";
  DECLARE ip_dst VARCHAR(64) default "";
  SELECT event.id, event.signature, event.timestamp
  INTO this_event, this_event_signature, this_event_timestamp
  FROM event
  WHERE event.sid = NEW.sid and event.cid = NEW.cid;  
  SELECT signature.sig_sid, signature.sig_gid, signature.sig_name 
  INTO this_sig, this_sig_gid, this_sig_name
  FROM signature
  WHERE signature.sig_id = this_event_signature;
  SELECT count(*), sigs_to_block.src_or_dst, sigs_to_block.timeout
  INTO interested, direction, timeout
  FROM sigs_to_block
  WHERE this_sig_name LIKE CONCAT(sigs_to_block.sig_name, '%');
  IF (interested > 0) THEN
   IF (direction = "src") THEN
      INSERT INTO block_queue
   SET que_ip_adr = inet_ntoa(NEW.ip_src),
          que_timeout = timeout,
          que_sig_name = this_sig_name,
          que_sig_gid = this_sig_gid,
          que_sig_sid = this_sig,
          que_event_timestamp = this_event_timestamp;
    ELSE
      INSERT INTO block_queue
   SET que_ip_adr = inet_ntoa(NEW.ip_dst),
          que_timeout = timeout,
          que_sig_name = this_sig_name,
          que_sig_gid = this_sig_gid,
          que_sig_sid = this_sig,
          que_event_timestamp = this_event_timestamp;
    END IF;
  END IF;
END


현재 mysql 5.7버전 사용하고 있습니다

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
Á¤ÀçÈ£02 2016-09
¾Ë¾Æ¼­ ÇØ°áÇß½À´Ï´Ù¸¸.. Ȥ½Ã Àú¿Í°°ÀÌ ±¸ÃàÇϽźÐÀÌ ÀÖ´Ù°¡ ¸·È÷½Å´Ù¸é Àú¿¡°Ô ÂÊÁö¸¦ ³²°ÜÁÖ¼¼¿ä
NeOpLe 2016-09
MySQL trigger µµ ¸¹ÀÌ º¯Ç߳׿ä.


QnA
Á¦¸ñPage 2604/5711
2014-05   5163430   Á¤ÀºÁØ1
2015-12   1697637   ¹é¸Þ°¡
2015-01   5546   °ÇÀüÁö
2006-08   5546   Á¤»ó¾ï
2006-08   5546   Â÷Çõ±Ù
2014-03   5546   ¸¶ÀÌ·¯ºê
2012-11   5546   À̼±È£
2009-06   5546   Á¤ÀºÁØ1
2015-07   5546   Àü¼³¼ÓÀǹ̡¦
2006-03   5546   ¼±µ¿¾ð
2006-07   5546   ¼ÛÀçÈÆ
2006-07   5546   À¯»ç¿ë
2005-07   5546   Á¤¸íÇö
2005-09   5546   ¹®Áö¼º
2008-03   5546   ÀÌÈñÅÂ
2009-03   5546   ±è±â¿µ
2016-10   5546   Christopher
2016-10   5546   2cpumem
2007-08   5546   ÀÌÁ¾Çö
2011-10   5546   ±è°Ç¿ì
2005-05   5546   ·ùÀåÈ£
2007-11   5546   Á¶ÀçÇö