From: "Patrick Finnegan" <[EMAIL PROTECTED]>

> For example if I run on Monday 07/01/2002 the report covers Mon
> 31/12/2001 to Sunday 06/01/2002.  It's possible to write this in the
> Windows shell but it's extremely convoluted.  You are better off using
> Tcl(Tool Control Language) or Perl.  Here is an example script using Tcl
> which calculates the required dates and feeds them to Analog.  Tcl is
> open source and can be downloaded from
> http://sourceforge.net/projects/tclpro

> ######################################
> # Date range for report is Monday to Sunday.
> # Job is usually run on Monday but Tcl script will calculate the dates
of
> the previous Sunday and Monday regardless of what day of the week the
> report is run
> ######################################

Unfortunately, your script is needlessly complex - Analog doesn't need to
know the dates of the previous Sunday and Monday to run a report for last
week. As I pointed out in the post you are replying to, FROM -00-00-07
will do that job quite nicely.

For the inexperienced scripter, VBScript is likely to be far easier to to
use than Tcl or perl, and it's probably already installed on the NT
machine anyway. http://www.microsoft.com/scripting/

Here's a VBScript for analysing the last 7 daily logs, that works across
month ends and year ends, but the original question was how to do this
with IIS's weekly logs, and adapting this script so that it will analyse
both EX020105.log and EX020201.LOG on Monday the 4th of February is non
trivial.

----
for x = 7 to 1 step -1   ' Get dates of the previous 7 days
  ydate = dateadd("d", - x, date)

' Construct string of EXYYMMDD.log entries from dates.
  logfiles = logfiles & "EX" & right(ydate, 2) & _
     mid(ydate, 4, 2) & left(ydate, 2) & ".log "

next

' Call Analog
Set WshShell = CreateObject("WScript.Shell")
Set oExec    = WshShell.Exec("Analog " & logfiles)

' display any errors or warnings generated by Analog
wscript.echo oExec.StdErr.ReadAll()
-----

(You need to specify OUTFILE in your analog.cfg file for this to work, and
you need to run the script at the command prompt to access StdErr, StdIn
and StdOut).

Aengus

> set current_time [clock format [clock seconds] -format %k%M%S]
>
> # get day number for current date in the current week.
>
> set current_day [clock format [clock seconds] -format %u]
>
> # get days_ago figure to the start of the current week.
>
> set days_ago [expr {$current_day -1}]
>
> # get the date for the Monday the of current week.
>
> set date_monday [clock format [clock scan "$days_ago day ago" -base
[clock
> seconds]] -format "%y%m%d"]
>
> # get the date for the previous Sunday.
>
> set to_date [clock format [clock scan "yesterday" -base [clock scan
> $date_monday]] -format "%y%m%d"]
>
> # get the date for the previous Monday.
>
> set from_date [clock format [clock scan "7 day ago" -base [clock scan
> $date_monday]] -format "%y%m%d"]
>
> set ext .html
> set split _
> set logformat {+CLOGFORMAT (%s %j "%u" [%d/%M/%Y:%h:%n:%j %j] "%j %r %j"
%c
> %b "%f" "%B")}
>
> ######################################
> # Call analog Report using dates.
> ######################################
>
> exec cmd /c D:\\analog5.1\\analog $logformat    \
>                                   $logfile1     \
>                                   $logfile2     \
>                                   +F$from_date  \
>                                   +T$to_date    \
>                                   +g$configfile \
>
> +O$outputfile$split$to_date$split$current_time$ext


+------------------------------------------------------------------------
|  This is the analog-help mailing list. To unsubscribe from this
|  mailing list, go to
|    http://lists.isite.net/listgate/analog-help/unsubscribe.html
|
|  List archives are available at
|    http://www.mail-archive.com/[email protected]/
|    http://lists.isite.net/listgate/analog-help/archives/
|    http://www.tallylist.com/archives/index.cfm/mlist.7
+------------------------------------------------------------------------

Reply via email to