Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Help Modifying some scripts.

Posted on 1997-09-19
9
168 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

829 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