Visa ett inlägg
Oläst 2007-11-21, 15:13 #2
gsocs avatar
gsoc gsoc är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Jun 2007
Inlägg: 568
gsoc gsoc är inte uppkopplad
Mycket flitig postare
gsocs avatar
 
Reg.datum: Jun 2007
Inlägg: 568
Ett perl script som räknar ut för apache, borde gå att göra för andra respektive mjukvaror också...

Du verkar ju inte behöva någon live lösning, dock kanske någon annan har nått bra förslag...

Citat:
#!/usr/bin/perl -w

use strict;

my $access_log = $ARGV[0];
my $total = 0;
my @chunks;

open(LOGFILE, $access_log) or die "Could not open $access_log $!";

# count amount of data.
while(<logfile>)
{
@chunks = split();
if($chunks[9] =~ /\d/)
{ $total += $chunks[9]; }
}

close(LOGFILE);

# convert to human readable; 1024 * 1024 = 1048576.
$total /= 1048576;

print "Amount of bandwidth : $total MB\n";
(Taget från ht tp:// w ww.schwer.us/journal/2005/09/03/count-bandwidth/)
gsoc är inte uppkopplad   Svara med citatSvara med citat