Previous Next

Thread: Webalizer (stone steps) for IIS6.0 -ADSI Perl Script - automatic generation of Web Stats

Last post 03-10-2008 11:47 AM by pilio. 0 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (1 items)

Sort Posts:

  • 03-10-2008, 11:47 AM

    • pilio
    • Not Ranked
    • Joined on 03-10-2008, 11:15 AM
    • Posts 1
    • pilio

    Webalizer (stone steps) for IIS6.0 -ADSI Perl Script - automatic generation of Web Stats

    Locked Reply Contact

    For those of you who want to produce Web statistics for IIS6.0, i have created a perl script which parses iis6.0 and produces stats for every virtual server. The script runs once everyday.



    I use Stone Steps webalizer. An improved version of webalizer ( http://www.stonesteps.ca/  )
     

    See just below the script;

     

    #!c:\perl\bin\perl
     
    use Win32;
    use Win32::OLE;
     
    $pattern="vivodi_customers";
     
    $template_conf="c:\\opt\\vivodi\\Webalizer_Stats\\webalizer_template.conf";
     
    $thetime=time-86400;
    @timedata=localtime($thetime);
     
    $thesec=$timedata[0];
    $themin=$timedata[1];
    $thehour=$timedata[2];
    $theday=$timedata[3];
    $themonth=$timedata[4];
    $themonth++;
    $theyear=$timedata[5];
    $theyear=$theyear-100;
    #$theyear+=2000;
     
     
     
    if ($thesec<10) {
            $thesec="0$thesec";
    }
    if ($themin<10) {
            $themin="0$themin";
    }
    if ($thehour<10) {
            $thehour="0$thehour";
    }
    if ($theday<10) {
            $theday="0$theday";
    }
    if ($themonth<10) {
            $themonth="0$themonth";
    }
    if ($theyear<10) {
            $theyear="0$theyear";
    }
     
    $thedate=$theyear.$themonth.$theday;
     
    print"==>$thedate\n";
     
     
     
     
    $ALL_OBJECTS = Win32::OLE->GetObject('IIS://' . 'localhost' . '/W3SVC');
    foreach my $object (in $ALL_OBJECTS) {
     
       if (($object->Class eq 'IIsWebServer')) {
            $w3svc_num=$object->name;
          
     
          $objIIS = Win32::OLE->GetObject("IIS://localhost/W3SVC/".$w3svc_num);
          $ph=$objIIS->{"ServerComment"};
          $logs=$objIIS->{LogFileDirectory} ;
          undef $objIIS;
     
          $objIIS = Win32::OLE->GetObject("IIS://localhost/W3SVC/".$w3svc_num.'/Root');
          $path=$objIIS->{Path};
          
          undef $objIIS;
     
         # print "=>$ph , ";
         # print "$path - ";
         # print "$logs"."\\"."W3SVC".$w3svc_num."\\ex".$thedate.".log"."\n";
          $logs_str="$logs"."\\"."W3SVC".$w3svc_num."\\ex".$thedate.".log";
          $webalizer_cmd="C:\\opt\\vivodi\\Webalizer_Stats\\webalizer_win_3_1_2_6\\webalizer_win_3_1_2_6\\webalizer.exe -c $template_conf $logs_str -o $path\\statistics -n $ph";
          
     
        if (!(-d "$path\\statistics")) {
               print "=>....$path ---$pattern\n";
               if ($path =~ m/$pattern/io) {
                system "mkdir $path\\statistics";
               }
     
        }
     
         
           print "$webalizer_cmd\n";
           system ($webalizer_cmd);
     
     
       }#endif
     
    }#endforeach
     
    undef $ALL_OBJECTS;

     

    Best Regards,

    Panagiotis Iliopoulos 

    http://panagiotis-iliopoulos.blogspot.com/

     

     



Page 1 of 1 (1 items)
Page view counter