Solved

Help Modifying some scripts.

Posted on 1997-09-19
9
163 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now