Dovecot Stats for Logwatch

@lbutlr kremels at kreme.com
Wed Jun 2 11:41:32 EEST 2021


On 02 Jun 2021, at 02:10, Plutocrat <plutocrat at gmail.com> wrote:
> Its here if anyone can use it. Any suggestions for improvement welcome. Use at your own risk etc.
> 
> https://gist.github.com/plutocrat/8a2033923e14670dd13611fc0b51fc0f

This looks good. My only comment is the script doesn't account for compressed logs.

LOG1="/var/log/dovecot.log.0.bz2"
LOG2="/var/log/dovecot.log"
bzcat $LOG1 | sed "0,/^$STARTTIME/d" > $TEMPFILE
cat $LOG2 >> $TEMPFILE 

Well, another comment, I think you meant these tow lines to read like this:

STARTDATE=$(head -n 1 $TEMPFILE | awk '{print $1 " " $2 " " $3 }')
ENDDATE=$(tail -n 1 $TEMPFILE | awk '{print $1 " " $2 " " $3 }')

Though I don't think the awk is necessary, the first 15 characters of the first and last lines contain the info you want to display.

Of course, it would begetter to handle this all transparently, but … meh.

-- 
"Are you pondering what I'm pondering?"
"I think so, Brain! But do I have what it take to be the 'Lord of the
	Dance'?"



More information about the dovecot mailing list