diff options
author | Michael Meckelein <mmeckelein@hq.adiscon.com> | 2007-08-13 14:07:49 +0000 |
---|---|---|
committer | Michael Meckelein <mmeckelein@hq.adiscon.com> | 2007-08-13 14:07:49 +0000 |
commit | 1af0699b39ba1261e6194974978b83ead4657ff9 (patch) | |
tree | 517c0b2c50039dfeb114b6e9b88566965c53d744 /contrib | |
parent | 70058d919e1ae62b15b1dd5211e782c2f8445724 (diff) | |
download | rsyslog-1af0699b39ba1261e6194974978b83ead4657ff9.tar.gz rsyslog-1af0699b39ba1261e6194974978b83ead4657ff9.tar.xz rsyslog-1af0699b39ba1261e6194974978b83ead4657ff9.zip |
mod /contrib/delete_mysql, prepared docs for releasev1-18-2
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/delete_mysql | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/delete_mysql b/contrib/delete_mysql index c0d2ce8a..3ed84d17 100644 --- a/contrib/delete_mysql +++ b/contrib/delete_mysql @@ -7,6 +7,8 @@ # This program was original part of of PHPloghost # Copyright (C) 2004 Tuatha de Dana # some modifications for rsyslog by mmeckelein at 2007-08-08 +# 2007-08-13 mmeckelein: added dbhost and some other improvements +# suggested by Michael Mansour - thx a lot! # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,8 +25,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111- 1307, USA. # Change these variables to reflect your situation. -database=sqlsyslogd -export table=logs +database=sqlrsyslogd +dbhost="localhost" +export table=systemevents sqluser="" password="" @@ -33,16 +36,17 @@ mysqld=/usr/bin/mysql # A couple of steps should be taken to maintain your database. # If not, the number of messages will fill your database. -# By default, logs are deleted after they're one year old. +# By default, logs are deleted after they're 30 days old. # Change this to meet your requirements. # rsyslog's default database template use two date columns # ReceivedAt and DeviceReportedTime. You can use either of # the two and in most cases it doesn't make a huge difference. # See the property replacer doc at http://www.rsyslog.com/doc # for details on the two dates. -SQL_DELETE="DELETE FROM $table WHERE ReceivedAt < CURDATE() - INTERVAL 1 year;" +SQL_DELETE="DELETE FROM $table WHERE ReceivedAt < CURDATE() - INTERVAL 30 DAY;" # After a large amount of rows have been deleted, we should # optimize the table. SQL_OPT="OPTIMIZE TABLE $table;"; -$mysqld -u$sqluser -p$password -e"$SQL_DELETE" -D$database $mysqld -u$sqluser -p$password -e"$SQL_OPT" -D$database +$mysqld -u$sqluser -p$password -h$dbhost -e"$SQL_DELETE" -D$database +$mysqld -u$sqluser -p$password -h$dbhost -e"$SQL_OPT" -D$database |