<!-- @(#) $Id: ./etc/rules/mysql_rules.xml, 2011/09/08 dcid Exp $

  -  Official MySQL rules for OSSEC.
  -
  -  Copyright (C) 2009 Trend Micro Inc.
  -  All rights reserved.
  -
  -  This program is a free software; you can redistribute it
  -  and/or modify it under the terms of the GNU General Public
  -  License (version 2) as published by the FSF - Free Software
  -  Foundation.
  -
  -  License details: http://www.ossec.net/en/licensing.html
  -->
  

<!-- MYSQL Log messages -->
<group name="mysql_log,">
  <rule id="50100" level="0">
    <decoded_as>mysql_log</decoded_as>
    <description>MySQL messages grouped.</description>
  </rule>

  <rule id="50105" level="3">
    <if_sid>50100</if_sid>
    <regex>^MySQL log: \d+ \S+ \d+ Connect</regex>
    <description>Database authentication success.</description>
    <group>authentication_success,</group>
  </rule>

  <rule id="50106" level="9">
    <if_sid>50105</if_sid>
    <match>Access denied for user</match>
    <description>Database authentication failure.</description>
    <group>authentication_failed,</group>
  </rule>
  
  <rule id="50107" level="0">
    <if_sid>50100</if_sid>
    <regex>^MySQL log: \d+ \S+ \d+ Query</regex>
    <description>Database query.</description>
  </rule>
  
  <rule id="50108" level="3">
    <if_sid>50100</if_sid>
    <regex>^MySQL log: \d+ \S+ \d+ Quit</regex>
    <description>User disconnected from database.</description>
  </rule>

  <rule id="50120" level="12">
    <if_sid>50100</if_sid>
    <match>mysqld ended|Shutdown complete</match>
    <description>Database shutdown messge.</description>
    <group>service_availability,</group>
  </rule>

  <rule id="50121" level="3">
    <if_sid>50100</if_sid>
    <match>mysqld started|mysqld restarted</match>
    <description>Database startup message.</description>
    <group>service_availability,</group>
  </rule>
  
  <rule id="50125" level="5">
    <if_sid>50100</if_sid>
    <regex>^MySQL log: \d+ \S+ \d+ [ERROR]</regex>
    <description>Database error.</description>
  </rule> 
  
  <rule id="50126" level="12">
    <if_sid>50125</if_sid>
    <match>Fatal error:</match>
    <description>Database fatal error.</description>
    <group>service_availability,</group>
  </rule>
  
  <rule id="50180" level="10" frequency="6" timeframe="120" ignore="60">
    <if_matched_sid>50125</if_matched_sid>
    <description>Multiple database errors.</description>
    <group>service_availability,</group>
  </rule>

</group> <!-- MYSQL -->

<!-- EOF -->
