diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-08-08 11:58:03 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-08-08 11:58:03 +0000 |
commit | df6c2ba072cda2c122646cbb91bed450f47b55ef (patch) | |
tree | 3abcb1c47cb0a8ce24facc5f5216c4241f9b6b49 | |
parent | f2511d3c610684b4c23dd91f1fbbfd90c935102d (diff) | |
download | rsyslog-df6c2ba072cda2c122646cbb91bed450f47b55ef.tar.gz rsyslog-df6c2ba072cda2c122646cbb91bed450f47b55ef.tar.bz2 rsyslog-df6c2ba072cda2c122646cbb91bed450f47b55ef.zip |
added a database cleanup script based on a suggestion of Michael Mansour.
Michael Meckelein adapted it sligthly for use with rsyslog.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | contrib/README | 12 | ||||
-rw-r--r-- | contrib/delete_mysql | 48 |
4 files changed, 63 insertions, 1 deletions
@@ -10,6 +10,8 @@ Version 1.18.1 (rgerhards), 2007-08-?? - all compile-time settings are now shown in rsyslogd -v, not just the active ones - enhanced performance a little bit more +- added config file directive $ActionResumeInterval +- fixed a bug that prevented compilation under debian sid --------------------------------------------------------------------------- Version 1.18.0 (rgerhards), 2007-08-03 - rsyslog now supports fallback actions when an action did not work. This diff --git a/Makefile.am b/Makefile.am index 08db3296..fa102bf2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,4 +11,4 @@ rsyslogd_SOURCES=syslogd.c pidfile.c template.c outchannel.c stringbuf.c srUtils rsyslogd_CPPFLAGS=$(mysql_includes) rsyslogd_LDADD=$(mysql_libs) $(zlib_libs) $(pthreads_libs) -EXTRA_DIST = doc/bugs.html doc/features.html doc/generic_design.html doc/history.html doc/how2help.html doc/install.html doc/ipv6.html doc/manual.html doc/property_replacer.html doc/rsyslog_conf.html doc/rsyslog_mysql.html doc/rsyslog_packages.html doc/rsyslog_php_syslog_ng.html doc/rsyslog_recording_pri.html doc/rsyslog_stunnel.html doc/status.html doc/syslog-protocol.html doc/version_naming.html doc/contributors.html redhat/rsyslog.conf redhat/rsyslog.init redhat/rsyslog.log redhat/rsyslog.sysconfig debian/rsyslogd freebsd/rsyslogd slackware/rc.rsyslogd rfc3195d.8 rklogd.8 rsyslogd.8 rsyslog.conf.5 createDB.sql +EXTRA_DIST = doc/bugs.html doc/features.html doc/generic_design.html doc/history.html doc/how2help.html doc/install.html doc/ipv6.html doc/manual.html doc/property_replacer.html doc/rsyslog_conf.html doc/rsyslog_mysql.html doc/rsyslog_packages.html doc/rsyslog_php_syslog_ng.html doc/rsyslog_recording_pri.html doc/rsyslog_stunnel.html doc/status.html doc/syslog-protocol.html doc/version_naming.html doc/contributors.html redhat/rsyslog.conf redhat/rsyslog.init redhat/rsyslog.log redhat/rsyslog.sysconfig debian/rsyslogd freebsd/rsyslogd slackware/rc.rsyslogd rfc3195d.8 rklogd.8 rsyslogd.8 rsyslog.conf.5 createDB.sql contrib/README contrib/delete_mysql diff --git a/contrib/README b/contrib/README new file mode 100644 index 00000000..d8ef3dd2 --- /dev/null +++ b/contrib/README @@ -0,0 +1,12 @@ +This directory contains a number of possibly useful things that do not +directly relate to rsyslog. They are not actively supported, but as +I said often helpful. Use them with some care, as they may be outdated +in respect to the current release of rsyslog. + +At least some of this stuff has been found by our users and been +included after a brief check and possibly an adapation. If you have +something useful you would like to see in contrib, just drop us a +note (see http://www.rsyslog.com for how to do that at the time your +are reading this document). + +rgerhards, 2007-08-08 diff --git a/contrib/delete_mysql b/contrib/delete_mysql new file mode 100644 index 00000000..c0d2ce8a --- /dev/null +++ b/contrib/delete_mysql @@ -0,0 +1,48 @@ +#!/bin/bash + +# Database maintance script which can be used for rsyslog +# and phplogcon default database schema. +# Michael Mansour suggested it to be included - thx! + +# This program was original part of of PHPloghost +# Copyright (C) 2004 Tuatha de Dana +# some modifications for rsyslog by mmeckelein at 2007-08-08 + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111- 1307, USA. + +# Change these variables to reflect your situation. +database=sqlsyslogd +export table=logs +sqluser="" +password="" + +# Location of the mysql daemon: +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. +# 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;" + +# 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 |