You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
Perhaps start with just DAYSTOREPAIR change:
# How many days of data do you want to keep?
DAYSTOKEEP=365
# How many days of data do you want to repair?
DAYSTOREPAIR=365
# You can override the above settings in:
source /etc/nsm/securityonion.conf
##############################################
# No need to change anything below this point
##############################################
# Check to see if there is a valid DB. If not, exit silently.
if [ ! -d /var/lib/mysql/$DATABASE/ ]; then exit; fi
KEEPDAY=`/usr/bin/mysql -u$DB_USER $PASSWORD_OPTION -BN -e "SELECT
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), '%Y%m%d');" -D
$DATABASE`
REPAIRDAY=`/usr/bin/mysql -u$DB_USER $PASSWORD_OPTION -BN -e "SELECT
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOREPAIR DAY), '%Y%m%d');"
-D $DATABASE`
echo "Retention policy set to $DAYSTOKEEP days (deleting data prior to
$KEEPDAY)."
# Define a cleanup function
cleanup() {
for TABLEPREFIX in "data" "event" "icmphdr" "sancp" "tcphdr" "udphdr"
do
/usr/bin/mysql -u$DB_USER $PASSWORD_OPTION -BN -e
"DROP TABLE $TABLEPREFIX;" -D $DATABASE
TABLES=(`/usr/bin/mysql -u$DB_USER $PASSWORD_OPTION
-BN -e "SHOW TABLES LIKE '$TABLEPREFIX%';" -D $DATABASE`)
for TABLE in "${TABLES[@]}"
do
TABLEDAY=`echo "$TABLE" | awk -F_ '{print($3)}'`
if [ "$TABLEDAY" -lt "$KEEPDAY" ]
then
/usr/bin/mysql -u$DB_USER
$PASSWORD_OPTION -BN -e "DROP TABLE \`$TABLE\`;" -D $DATABASE
else
[ "$TABLEDAY" -gt "$REPAIRDAY" ] &&
/usr/bin/mysql -u$DB_USER $PASSWORD_OPTION -BN -e "REPAIR TABLE
\`$TABLE\`;" -D $DATABASE
fi
done
done
Original comment by doug.bu...@gmail.com on 15 Nov 2013 at 7:09
Original issue reported on code.google.com by
doug.bu...@gmail.com
on 9 Jul 2013 at 1:27The text was updated successfully, but these errors were encountered: