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
  #11 (permalink)  
Old 02-16-2006, 12:09 PM
Active Member
 
Posts: 49
Default

Quote:
Originally Posted by marcmac
This is weird.
It's a special talent i have.

Looks like none of them failed.

zimbra@dmrmail01:/tmp> /opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogRawLifetime'
zimbraLogRawLifetime: 31d
zimbra@dmrmail01:/tmp> /opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogRawLifetime' | sed -e 's/zimbraLogRawLifetime: //'
31d
zimbra@dmrmail01:/tmp> /opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogSummaryLifetime'
zimbraLogSummaryLifetime: 731d
zimbra@dmrmail01:/tmp> /opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogSummaryLifetime' | sed -e 's/zimbraLogSummaryLifetime: //'
731d
zimbra@dmrmail01:/tmp> /opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogSummaryLifetime' | sed -e 's/zimbraLogSummaryLifetime: //'
731d

I ran /opt/zimbra/bin/zmlogprocess after the above commands and still returned the text below:

Aggregating hour disk from 2006-02-16 09:00:00 to 2006-02-16 10:00:00
Aggregating hour disk from 2006-02-16 10:00:00 to 2006-02-16 11:00:00
Aggregating day disk from 2006-02-15 00:00:00 to 2006-02-16 00:00:00
RAW: 31
sed: -e expression #1, char 28: unterminated `s' command
grep: write error: Broken pipe
SUM:
Pruning raw mta logs from 2006-01-16 00:00:00
Pruning raw amavis logs from 2006-01-16 00:00:00

I have been editing some of my SuSE files with Pico. Specifically, the zmlogprocess script and the syslog-ng file. Is it possible i just made a typo somewhere? To troubleshoot that, I undid my changes but the issue still existed, so i am under the assumption that my edits are not the issue. Thanks again.
Reply With Quote
  #12 (permalink)  
Old 02-16-2006, 12:20 PM
Zimbra Employee
 
Posts: 2,103
Default

Pico? That's just wrong....

Here's the relevant section:
Code:
sub pruneLogs {
    my $rawRetention = `/opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogRawLifetime' | sed -e 's/zimbraLogRawLifetime: //'`;
    chomp $rawRetention;
    $rawRetention =~ s/d//;
    print "RAW: $rawRetention\n";
    my $summaryRetention = `/opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogSummaryLifetime' | sed -e 's/zimbraLogSummaryLifetime: //'`;
    chomp $summaryRetention;
    $summaryRetention =~ s/d//;
    print "SUM: $summaryRetention\n";

    my $now = time();

    my $rawBegin = tsToSqlTime($now - (60*60*24*$rawRetention),1);
    my $summaryBegin = tsToSqlTime($now - (60*60*24*$summaryRetention),1);

    my $sth;

    print "Pruning raw mta logs from $rawBegin\n";
    $sth = sqlExec ("delete from mta where arrive_time < '".$rawBegin."'");
    print "Pruning raw amavis logs from $rawBegin\n";
    $sth = sqlExec ("delete from amavis where arrive_time < '".$rawBegin."'");
    print "Pruning raw disk logs from $rawBegin\n";
    $sth = sqlExec ("delete from disk_status where time < '".$rawBegin."'");
    print "Pruning summary mta logs from $summaryBegin\n";
    $sth = sqlExec ("delete from mta_aggregate where period_start < '".$summaryBegin."'");
    print "Pruning summary amavis logs from $summaryBegin\n";
    $sth = sqlExec ("delete from amavis_aggregate where period_start < '".$summaryBegin."'");
    print "Pruning summary disk logs from $summaryBegin\n";
    $sth = sqlExec ("delete from disk_aggregate where period_start < '".$summaryBegin."'");
    print "Pruning other raw logs from $rawBegin\n";
    $sth = sqlExec ("delete from raw_logs where log_date < '".$rawBegin."'");
}
AFAICT, it's failing on the sed line referring to zimbraLogSummaryLifetime. Does it show up as above (especially the "//" at the end?) Also, be aware that line ends with:
"//'`" - slash-slash-singlequote-backtick

One other thing you can try - change the sed calls to a full path (which sed) though I can't see why one would fail, and the other succeed.

If you can paste that function from your script into the forums (in CODE tags) that may help.
Reply With Quote
  #13 (permalink)  
Old 02-16-2006, 12:40 PM
Active Member
 
Posts: 49
Default

Quote:
Originally Posted by marcmac
Pico? That's just wrong....
- LOL

Here's my code as it exists now. I'm going to look at it closer. Thanks.

edit - sorry - here is the complete code.

Code:
sub pruneLogs {
        my $rawRetention = `/opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogRawLifetime' | sed -e 's/zimbraLogRawLifetime: //'`;
        chomp $rawRetention;
        $rawRetention =~ s/d//;
        print "RAW: $rawRetention\n";
        my $summaryRetention = `/opt/zimbra/bin/zmprov gacf | egrep '^zimbraLogSummaryLifetime' | sed -e 's/zimbraLogSummaryLifetime:
//'`;
        chomp $summaryRetention;
        $summaryRetention =~ s/d//;
        print "SUM: $summaryRetention\n";

                        
        my $now = time();
                                        
        my $rawBegin = tsToSqlTime($now - (60*60*24*$rawRetention),1);
        my $summaryBegin = tsToSqlTime($now - (60*60*24*$summaryRetention),1);
                                        
        my $sth;
                                        
        print "Pruning raw mta logs from $rawBegin\n";
        $sth = sqlExec ("delete from mta where arrive_time < '".$rawBegin."'");
        print "Pruning raw amavis logs from $rawBegin\n";
        $sth = sqlExec ("delete from amavis where arrive_time < '".$rawBegin."'");
        print "Pruning raw disk logs from $rawBegin\n";
        $sth = sqlExec ("delete from disk_status where time < '".$rawBegin."'");
        print "Pruning summary mta logs from $summaryBegin\n";
        $sth = sqlExec ("delete from mta_aggregate where period_start < '".$summaryBegin."'");
        print "Pruning summary amavis logs from $summaryBegin\n";
        $sth = sqlExec ("delete from amavis_aggregate where period_start < '".$summaryBegin."'");
        print "Pruning summary disk logs from $summaryBegin\n";
        $sth = sqlExec ("delete from disk_aggregate where period_start < '".$summaryBegin."'");
        print "Pruning other raw logs from $rawBegin\n";
        $sth = sqlExec ("delete from raw_logs where log_date < '".$rawBegin."'");
}

Last edited by DMRDave; 02-16-2006 at 12:48 PM..
Reply With Quote
  #14 (permalink)  
Old 02-16-2006, 01:08 PM
Zimbra Employee
 
Posts: 2,103
Default

Of course, the important line got wrapped...

You could try this - dump the sed line, and just hardcode the summaryRetention to be 731:
my $summaryRetention = 731;
Reply With Quote
  #15 (permalink)  
Old 02-16-2006, 01:12 PM
Active Member
 
Posts: 49
Default

Thanks for your assistance Marc,

Looks like it was an unneeded hard return in the code. Embarrassing. The error went away after removing the "return" and stopping and starting the server.
Reply With Quote
  #16 (permalink)  
Old 02-16-2006, 01:16 PM
Zimbra Employee
 
Posts: 2,103
Default

That'll teach you to use pico...


Glad it's working.
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.