Re: [squid-users] How to set /etc/logrotate.d/squid to have good sarg reports?

From: Helmut Hullen <Hullen_at_t-online.de>
Date: 29 Nov 2012 15:58:00 +0100

Hallo, Bartosz,

bartosz.c_at_gmail.com meinte am 29.11.12 in squid zum Thema Re: [squid-users] How to set /etc/logrotate.d/squid to have good sarg reports?:

>> My system runs the "sarg" reports at the end of the day, as a
>> separate cronjob, and "logrotate" runs in the very early morning, as
>> part of "cron.daily".

[...]

> And after rotating you are having only one day in log file, dont you?

Yes, that may happen.

I've just written a quick and dirty script which deletes all sarg
directories which are older than 3 months. It's invoked from the "/etc/
cron.monthly" directory, it could be invoked from a simple cron job
instead.
The only thing you should change is "DocRoot".

#! /bin/bash
# loescht alte "sarg"-Verzeichnisse
# Helmut Hullen

DocRoot=/home/www/squid-reports

sargRef=/tmp/sarg$$
touch -d 'now - 3 months' $sargRef || exit 1

for Verz in $DocRoot/*
  do
    test -d $Verz || continue
    test -s $Verz/sarg-date || continue
    test $Verz/sarg-date -nt $sargRef && continue
    rm -rf $Verz
  done

rm -f $sargRef
#

# ======================================================================

# $Id: sarg-alt,v 1.1 2012-11-29 15:39:53+01 HHullen Exp $
# $Log: sarg-alt,v $
# Revision 1.1 2012-11-29 15:39:53+01 HHullen
# Start
#

This script is independent from every logrotate mechanism.

Viele Gruesse!
Helmut
Received on Thu Nov 29 2012 - 15:00:10 MST

This archive was generated by hypermail 2.2.0 : Thu Nov 29 2012 - 12:00:05 MST