## to monitor the binary log files and to find wheather the tables have created,altered or dropped on last one day and sending mails
we can use any one of the command
Note: give the correct path wher the binary log files exist default is "/var/lib/mysql"
find /var/lib/mysql -name 'mysql-bin.0*' -exec mysqlbinlog {} \; | awk '/(\<^create\>|\<^alter\>|\<^drop\>)/,/;/' IGNORECASE=1 | mail -s "tables altered on `hostname`" kiran.chinta@gmail.com
mysqlbinlog /var/lib/mysql/mysql-bin.000010 | awk '/(\<^create\>|\<^alter\>|\<^drop\>)/,/;/' IGNORECASE=1 | mail -s "tables altered on `hostname`" kiran.chinta@gmail.com
we can use any one of the command
Note: give the correct path wher the binary log files exist default is "/var/lib/mysql"
find /var/lib/mysql -name 'mysql-bin.0*' -exec mysqlbinlog {} \; | awk '/(\<^create\>|\<^alter\>|\<^drop\>)/,/;/' IGNORECASE=1 | mail -s "tables altered on `hostname`" kiran.chinta@gmail.com
mysqlbinlog /var/lib/mysql/mysql-bin.000010 | awk '/(\<^create\>|\<^alter\>|\<^drop\>)/,/;/' IGNORECASE=1 | mail -s "tables altered on `hostname`" kiran.chinta@gmail.com

No comments:
Post a Comment