Results 1 to 6 of 6

Thread: logger database growth

  1. #1
    Join Date
    Sep 2007
    Posts
    36
    Rep Power
    8

    Default logger database growth

    Here is a script that cleans records in logger database.

    Code:
    #!/bin/bash
    
    AMAVIS=10 #keep last 10 days
    MTA=30 #keep last 30 days
    RAW=2 #keep last 2 days
    
    /opt/zimbra/bin/logmysql -D zimbra_logger << EOF
    delete from amavis where arrive_time < adddate(curdate(),interval -$AMAVIS day);
    optimize table amavis;
    select count(*)  AS amavis_rec_left from amavis;
    delete from mta where (arrive_time > "2000-01-01" and arrive_time < adddate(curdate(),interval -$MTA day)) or (leave_time > "2000-01-01" and leave_time < adddate(curdate(),interval -$MTA day));
    optimize table mta;
    select count(*) AS MTA_rec_left from mta;
    delete from raw_logs where log_date < adddate(curdate(),interval -$RAW day);
    optimize table raw_logs;
    select count(*) AS raw_rec_left from raw_logs;
    quit
    EOF
    Run it under zimbra account.
    If you logger db is already big the script will work long time. In that case before run it do "zmlogswatchctl stop" in order to stop processes that works with logger database.

    For first time is good to clean db manually if the database is very big. In my case raws_logs table was about 40gb
    The commands bellow will delete all data in three tables. If you need this data don't execute them!
    Code:
    $zmlogswatchctl stop 
    (don't execute "zmloggerctl stop" this also stops logger mysqld)
    $logmysql -D zimbra_logger
    mysql> delete from amavis;
    mysql> optimize table amavis;
    mysql> delete from mta;
    mysql> optimize table mta;
    mysql> delete from raw_logs;
    mysql> optimize table raw_logs;
    mysql> quit
    $zmlogswatchctl start
    Be patient, each deleting query may lasts for a long time.
    Last edited by borispr; 04-06-2009 at 12:44 PM.

  2. #2
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    11

    Default

    Hi..it would be nice if you can add this to Zimbr Wiki page for logger Troubleshooting

    Logger - Zimbra :: Wiki

    Thanks
    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  3. #3
    Join Date
    Sep 2007
    Posts
    36
    Rep Power
    8

    Default

    Quote Originally Posted by raj View Post
    Hi..it would be nice if you can add this to Zimbr Wiki page for logger Troubleshooting

    Logger - Zimbra :: Wiki

    Thanks
    Raj
    done
    How to shrink logger database

  4. #4
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    11

    Default

    Thanks for the wiki update..

    i am too lazy to do this..i just delete the whole thing and recreate...lol

    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  5. #5
    Join Date
    Mar 2007
    Location
    Small village in the center of Italy
    Posts
    350
    Rep Power
    8

    Default

    is this safe for zcs 7.x.x, too?

    Code:
    $zmlogswatchctl stop (don't execute "zmloggerctl stop" this also stops logger mysqld)
     $logmysql -D zimbra_logger
     mysql> delete from amavis;
     mysql> optimize table amavis;
     mysql> delete from mta;
     mysql> optimize table mta;
     mysql> delete from raw_logs;
     mysql> optimize table raw_logs;
     mysql> quit
     $zmlogswatchctl start

  6. #6
    Join Date
    Mar 2007
    Location
    Small village in the center of Italy
    Posts
    350
    Rep Power
    8

    Default

    it doesn't, at all ;(
    logmysql is not part of a zimbra 7.x installation
    Last edited by maumar; 10-03-2011 at 01:26 AM.

Similar Threads

  1. Replies: 23
    Last Post: 01-24-2013, 03:44 PM
  2. Replies: 12
    Last Post: 05-19-2009, 12:07 PM
  3. Database logger Error
    By jayel in forum Administrators
    Replies: 1
    Last Post: 01-06-2009, 05:32 AM
  4. Getting database logger connection
    By HTR in forum Administrators
    Replies: 1
    Last Post: 06-17-2008, 08:59 AM
  5. [SOLVED] Zimbra Logger Database file gone
    By shrek in forum Administrators
    Replies: 2
    Last Post: 05-05-2008, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •