Solved

Help Modifying some scripts.

Posted on 1997-09-19
9
167 Views
Last Modified: 2013-12-25
I downloaded some statistic script from http://acm.vt.edu/¨nisha/logscribe/
Now I nead som help modifying it.

I also like som statistic month by month that looks like the output from the stats By Day part. /Take a look at http://www2.crossnet.se/linkcenter/cgi-bin/logscribe/showlog.pl/?day

But I want it to make a stat by month like this:


January:  4 #### (30%)
February: 5 ##### (32%)
........
December  2 ###   (7%)


(But not with the character #. I wan't the same format as in the link abow.)
0
Comment
Question by:n94magho
  • 4
  • 4
9 Comments
 
LVL 10

Expert Comment

by:kollegov
ID: 1830404
I made changes, but have no ability to check it well enough.
(no logs stats to check :(  )
Hope I do it accurate.
If you have file with logs, I'd like to have it
to check script carefully, or you can play with
mew one yourself to check it.

How can I send you file?
Changes are only in showlog.pl file, so I'd like to
e-mail it to you :)

------Virtual_Max-------
http://www.geocities.com/siliconvalley/lakes/8620


0
 

Author Comment

by:n94magho
ID: 1830405
Sorry for rejecting your answer. But I don't Know how to leave you my adress in some other way. My adress is mike@a201.ryd.student.liu.se. If it works good I'll be glad to give  you the points. I wounder about one thing. If I don't have to modify the makelog part. How can it work? The makelog opens a new file after 30 days. I thougt that I neded a new part in the makelog that only logged some info to another file during all months of the year...
0
 

Author Comment

by:n94magho
ID: 1830406
One more thing. I have modifyed something in the srcipt by my self, so could you please make some comment in the script about what's new??
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 10

Expert Comment

by:kollegov
ID: 1830407
I'll send you script in a few minutes :)
Mike, read carefully readme.txt file,
than open config.pl and change log length
from 30 days to 365

piece of script from config.pl

#------------------------------------#
# How many days do you want to log ? #
#------------------------------------#
$numofdays = 365;

Opps sorry I forgot to give you my email:

Virtual_Max@geocities.com
http://www.geocities.com/siliconvalley/lakes/8620

0
 
LVL 10

Expert Comment

by:kollegov
ID: 1830408
Just send you new one with modifications and
comments
search in text for "Kollegov" multiple changes places
and you will catch all changes.



0
 

Author Comment

by:n94magho
ID: 1830409
Everything workss perfectly, But I still like to use the $numofdays to be set to 30, thats why I thaught that the makelog neaded som changes. (Mabe it have to logg to two separate files. one th keep the track of visits / month. )
If you just help me with this I'll be more than hapy.

0
 
LVL 84

Expert Comment

by:ozo
ID: 1830410
It looks like makelog already saves the older than $numdays entrys in $oldlogfile,
So all you'd need to add in showlog is:
open(OLDLOG,"<$oldlogfile")||warn "can't open $oldlogfile $!";
while(<OLDLOG>){
          $months[(localtime(split[0]))[4]]++ if $_ ne "LOG-BEGIN\n";
}
close OLDLOG;

sub by_month{
  $highest=1;
  for(@months){
      $highest = $_ if $_ > $highest;
  }
 print "  <H2><U>Stats By Month</U></H2>\n";
 print "  <TABLE>\n";

  @monthnames=(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
   foreach(@months){
      $barsize=int(($_ * 250) / $highest);
      $showpercent = sprintf("%.3f",($_ / $nooflines) * 100);
$key = shift(@montnames);
 print<<EOF;
   <TR>
    <TH ALIGN=RIGHT>$key:</TH>
    <TD NOWRAP ALIGN=LEFT>
     <IMG BORDER=1 SRC="$gifdirurl/dot1.gif" HEIGHT=10 WIDTH=$barsize>
     <B>$_</B> <I> $showpercent</I>
    </TD>
   </TR>
EOF
 }
 print "  </TABLE>\n";
 print "  <P><HR><P>\n";
}

  }
}
foreach

0
 
LVL 10

Accepted Solution

by:
kollegov earned 300 total points
ID: 1830411
Mike, I found errors in edition you send me.

0
 

Author Comment

by:n94magho
ID: 1830412
Sorry! For taking so much of your time.
Now everything works fine....
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question