Navigation : DEVELOPPEMENT > PERL
LECTURE DU LOG BRUT D'APACHE
Ce scipt CGI permet d'ouvrir en affichage le log Apache du site.
www.polyteknique.netDETAIL DU SCRIPT
#!/usr/bin/perl -w

use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n";
print "<html><head><title>CGI PERL LOG APACHE</title></head><body>\n";
print "<h1>LOG WEB APACHE WWW.POLYTEKNIQUE.NET</h1><br>\n";

($secondes, $minutes, $heures, $jour_mois, $mois,
        $an, $jour_sem, $jour_calend, $heure_ete) = localtime(time);

$mois += 1;
$mois  = $mois < 10 ? $mois = "0".$mois : $mois;
$an    = substr($an, 1, 2);

open (LOG, "< /data/www/net/e/u/polyteknique.net/www/logs/access_log_$mois$an");

   print "<font size=2><table border=1>";
   while ($ligne = <LOG>){
      print "<tr><td>$ligne</td></tr>";
   }
   print "</table></font>";
   print "</body></html>\n";

close (LOG);
www.polyteknique.netLES LIENS :
TESTER LA LECTURE DU LOG APACHE : cgi-bin/logapache.pl

Rédigé le : 2004-02-16 21:43:12