Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-06-2009, 06:21 AM
Active Member
 
Posts: 36
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 11:44 AM..
Reply With Quote
  #2 (permalink)  
Old 04-06-2009, 06:55 AM
raj raj is offline
Moderator
 
Posts: 768
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
Reply With Quote
  #3 (permalink)  
Old 04-06-2009, 07:30 AM
Active Member
 
Posts: 36
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
Reply With Quote
  #4 (permalink)  
Old 04-06-2009, 07:34 AM
raj raj is offline
Moderator
 
Posts: 768
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
Reply With Quote
  #5 (permalink)  
Old 10-01-2011, 02:43 AM
Elite Member
 
Posts: 296
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
Reply With Quote
  #6 (permalink)  
Old 10-02-2011, 06:30 AM
Elite Member
 
Posts: 296
Default

it doesn't, at all ;(
logmysql is not part of a zimbra 7.x installation

Last edited by maumar; 10-03-2011 at 12:26 AM..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.