Sign in to follow this  
lt.larry

Scheduled removal of infistar logs from db

2 posts in this topic

So I would like to clear my infistar logs after say 5 days because it's already like 130 000 rows and I'm sure I saw a post somewhere in forums but I just cannot find it anymore...

Share this post


Link to post
Share on other sites

If someone else is trying to find a script which deletes rows from infistar_logs table that are older than 10 days

DELETE FROM infistar_logs WHERE time < TIMESTAMP(DATE_SUB(NOW(), INTERVAL 10 DAY))

You can replace DAY with MINUTE and change the value to your likes.

Here is the event scheduler script

CREATE DEFINER=`XXXX`@`127.0.0.1` EVENT `infistar cleanup`
    ON SCHEDULE
    EVERY 1 DAY STARTS '2017-03-13 06:00:00'
    ON COMPLETION NOT PRESERVE
    ENABLE
    COMMENT 'Clean infistar log'
    DO DELETE FROM infistar_logs WHERE time < TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 DAY))

Im a total noob when it comes to mysql so this could work or not . Atleast it didn't corrupt my database...

(XXXX is your database username)

Edited by lt.larry
continuing my monologue
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.