On Thu, 16 Sep 1999, you wrote:
>Hi!
>
> I am about to begin compressing log files and using Analog to report
>on them and I thought I would see if anyone had some code I could use so I
>don't have to re invent the wheel so to speak. I am using Red Hat Linux
>5.1 with Apache Web Server. Here are my goals.
> 1.) I am hosting multiple sites and I would like to report on
>each one individually. I will use cron to run analog on multiple cfg files.
>
> 2.)I would like to archive the log file and run monthly (maybe
>weekly) summary reports and put them on each web site I host
>(www.site.com/log/july; www.site.com/log/august....). One of the tricks is
>to get the month (by name or number) and use it in the path of the site.
>
> If anyone has code or suggestions it would be greatly appreciated.
>Basically looking for helpsetting up cron and the cfg file to read the
>compressed files dynamically. And cron jobs to compress the files for me.
>Or a better way to do this that I haven't thought of. Thanks in advance.
>
Hi,
I do more or less the same thing, although this is Suse 6.1.
I have 3 entries in the cron, a daily a weekly and a monthly. The log files are
moved over using mirror, although I might suggest using rsync...
0 07 1 * * (cd /ale/work/stats/; ./anamonth.sh 2>&1 |mail
[EMAIL PROTECTED])
This runs it all at around 7am on the 1st of the month. & mails me the errors.
the analog cfg command for compression is something like:
UNCOMPRESS *.gz,*.Z "gzip -cd"
They are compressed on the webserver each night and mirrored over as gzip to a
tidy directory structure.
The monthly file does the following stuff:
Sets a TODAY variable:
TODAY=`date --date="5 days ago" +%B%y`
This makes extra sure that the month variable in $TODAY is always last months.
This is just a prettified TODAY variable for html output:
THISMONTH=`date --date="5 days ago" +%B%t%Y`
Then for any site it's the following big pipe:
zcat `find /home/logs/sites/www.site.com -name '*transfer-log*gz' -mtime
-32` | /path/analog/analog +ganalog/generic.cfg +C"FROM -00-01-00:0000"
+C"TO -00-00-00:0000"
This line does the analog stuff. It's piping in a listing of all the logfiles
created in the past 32 days into analog, which has a line in the cfg saying
it's getting it's input from STDIN.
LOGFILE -
This allows me to keep only about 4 generic config files for analog, with the
only differences between them being the inclusions/exclusions (which don't
work in command lines). zcatting only the last 30 days or so saves a lot of
time: otherwise analog goes through all the log files it can find for that site!
What I do put in the command line is the FROM / TO analog commands, so I use
the same config file for weekly, daily and monthly reports.
Also, because I'm outputting to report magic, there's no need for site
information (titles or urls). They go in individual rmagic .ini files:
/software/rmagic/rmagic.pl usasite.ini
The following lines make a directory for this month, and copy the new stats
files into it for viewing by big important businessy people.
mkdir /software/apache/htdocs/site/stats/$TODAY
cp /software/apache/htdocs/site/stats/output/*
/software/apache/htdocs/site/stats/$TODAY/ &&
echo "<li><a href=\"$TODAY\" title=\"$THISMONTH\">Month of $THISMONTH</a>"
>> /software/apache/htdocs/site/stats/incl_monthlist.html
That last line is a server side include that gets appended to with a new html
list item each month. This makes sure the whole thing is automated...
Final move, I rsync it all to the live server (This was all happening on our
internal server) , but this is still under construction: It should be something
like:
/software/rsync/bin/rsync --rsync-path /path_to_rsync_on_live_server/rsync -u -e
/path_to_ssh2_on_live_server/ssh2 -z -r -v /software/apache/htdocs/site/stats/*
liveserver:/path_to_sites_on_live_server/stats/
Hope this is understandable and useful!
Ale
>Tod
>
>------------------------------------------------------------------------
>This is the analog-help mailing list. To unsubscribe from this
>mailing list, send mail to [EMAIL PROTECTED]
>with "unsubscribe analog-help" in the main BODY OF THE MESSAGE.
>List archived at http://www.mail-archive.com/[email protected]/
>------------------------------------------------------------------------
--
Alejandro Fernandez,
[EMAIL PROTECTED]
------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe analog-help" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------