title: How to delete this event from snort sql?
body: <p>How can we delete this event from snort sql ?</p>
  
  <p><a href="https://i.stack.imgur.com/Xttbk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xttbk.png" alt="enter image description here"></a></p>
  
  <p>I tried this:</p>
  
  <p>Create a sql file on Snort machine : nano dbclean.sql</p>
  
  <p>Add the following code to the sql file:</p>
  
  <pre><code>use snort;
  DELETE FROM event WHERE timestamp &lt; DATE_SUB(NOW(),INTERVAL 28 DAY);
  DELETE FROM data    USING data    LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM iphdr   USING iphdr   LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM icmphdr USING icmphdr LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM tcphdr  USING tcphdr  LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM udphdr  USING udphdr  LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM opt     USING opt     LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM acid_event USING acid_event LEFT OUTER JOIN event USING (sid,cid) WHERE event.sid IS NULL;
  DELETE FROM ag USING acid_ag_alert AS ag LEFT OUTER JOIN event AS e ON ag.ag_sid=e.sid AND ag.ag_cid=e.cid WHERE e.sid IS NULL;
  OPTIMIZE TABLE event, data, iphdr, icmphdr, tcphdr, udphdr, opt, acid_event, acid_ag_alert;
  </code></pre>
  
  <ol start="2">
  <li><p>Next:</p>
  
  <pre><code>mysql -h YOUR-DB-HOST -uYOUR-DB-USER -pYOUR-DB-PASSWORD &lt; dbclean.sql
  </code></pre></li>
  </ol>
  
  <p>But didn't work.Please help.</p>