Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2005 10:21:22 +0200
From:      Ivailo Tanusheff <i.tanusheff@procreditbank.bg>
To:        RacerX@makeworld.com
Cc:        FreeBSD - Questions <freebsd-questions@freebsd.org>, FreeBSD - Ports <freebsd-ports@freeBSD.org>
Subject:   Re: Sarg scripts
Message-ID:  <OFCC905C26.CD50D30F-ONC22570BC.002D2608-C22570BC.002DE7C8@procreditbank.bg>
In-Reply-To: <437BCDC2.2010102@makeworld.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Maybe mine is not perfect, but this is what I use at work :)
I use several conf files, like sarg_proxy_daily.conf. The only difference 
between those files is where to put output files, as I use different 
filders for different type or reports, i.e. I have dayly, weekly, monthly 
and yearly folder :)
You can use only one config to store all data in the same place or use 
proper command option. Hope this will help you:



root@logserver# cat /usr/local/etc/reports/proxy_squid.sh
#!/bin/sh -x

######################
#                       #
#       Config                  #
#                                       #
#####################

LOGDIR=/data/proxy/logs

TODAY=$(date +%d/%m/%Y)
YESTERDAY=$(date -v-1d +%d/%m/%Y)
WEEKAGO=$(date -v-1w -v-1d +%d/%m/%Y)
MONTHAGO=$(date -v-1m -v-1d +%d/%m/%Y)
YEARAGO=$(date -v-1y -v-1d +%d/%m/%Y) 


###################### 
#                                       #
#       Script                          #
#                                       #
#####################


if [ $# -ne 1 ]; then
  /bin/echo "Usage: `basename $0` [d|w|m|y]"
  exit 0
fi


case "$1" in
  d)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_daily.conf -d 
$YESTERDAY-$YESTERDAY -x
    ;;

  w)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_weekly.conf -d 
$WEEKAGO-$YESTERDAY
    ;;

  m)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_monthly.conf -d 
$MONTHAGO-$YESTERDAY 
    ;;

  y)
    /usr/local/bin/sarg -f /usr/local/etc/sarg/sarg_proxy_yearly.conf -d 
$YEARAGO-$YESTERDAY
    ;;
 
  *)
    /bin/echo "Usage: `basename $0` [d|w|m|y]"
    ;;
esac



Ivailo Tanusheff
Senior System administrator
ProCredit Bank (Bulgaria) AD
http://www.procreditbank.bg




Chris <racerx@makeworld.com> 
Sent by: owner-freebsd-questions@freebsd.org
11/17/2005 02:24 AM
Please respond to
RacerX@makeworld.com


To
FreeBSD - Questions <freebsd-questions@freebsd.org>, FreeBSD - Ports 
<freebsd-ports@freeBSD.org>
cc

Subject
Sarg scripts






If anyone is using sarg (/usr/ports/www/sarg) I would really appreciate
what you are doing for gathering daily/weekly/monthly info.

This would be in the form of scripts I assume and cron.


-- 
Best regards,
Chris

You can observe a lot just by watching.
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OFCC905C26.CD50D30F-ONC22570BC.002D2608-C22570BC.002DE7C8>