Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Can I safely empty LUM_IpHistory?

I wonder if I can safely empty this table if I don't have IP logging on any more? It's nearly 6mb in size so it would be handy. Could someone please re-assure me?

Comments

  • Certainly shouldn't do any harm I dont think. Best way would be to mysql-dump it first so you have a backup. Then you can replace it if you need to.
  • thanks. i'll report back if anything goes wrong.
  • Crikey times two!

    Mine was 16Mb!

    I think the Forum Statistics extension uses this table?

    Surely there's a better way to keep this as a counter? Does it really need to keep all the IP addresses or will a counter do?

    It's not where the "Last Known Ip" is stored because when I emptied that table, the information is still there.
  • Ah the dreaded LUM_IpHistory.

    AFAIK, this is used for the Who's Online, IP History, and Statistics extensions, all of which I've got installed.

    I decided to whip up a monthly clean-up script that runs via crontab. Maybe it'll be useful for someone. You should replace the DB, TABLE, MYSQL_USER, MYSQL_PW and LOGFILE variables to something appropriate for your server. The INTERVAL is in days. This script also assumes it's accessing the database on localhost:
    #! /usr/local/bin/bash

    if [ $# -ne 0 ]
    then
    echo "No arguments accepted to this script right now"
    exit 1
    fi

    DB='vanilla'
    TABLE='LUM_IpHistory'
    INTERVAL=30
    LOGFILE=$HOME'/trim-vanilla.log'
    MYSQL_USER='sql'
    MYSQL_PW='pw'
    echo "Deleting records older than $INTERVAL days of IP history from $DB"
    echo "$0 run at: `date`" >> $LOGFILE
    /usr/local/bin/mysql -u $MYSQL_USER -p$MYSQL_PW -e "use $DB; DELETE FROM $TABLE WHERE DateLogged < DATE_SUB(NOW(), INTERVAL $INTERVAL DAY); OPTIMIZE TABLE $TABLE;" >> $LOGFILE


    The crontab entry looks like so, which runs the script weekly at 2:40am. Any additional output the script creates is also appended to the logfile:
    4 2 * * 0 /path/to/trim-vanilla-ip-history >> $HOME/trim-vanilla.log
    To run the script monthly:
    4 2 1 * * /path/to/trim-vanilla-ip-history >> $HOME/trim-vanilla.log
  • chris said...
    i just did this, 24mb, crikey.
    now up to 76.4mb :D
Sign In or Register to comment.