• [^] # Re: Pas facile comme ca

    Posté par (site web personnel) . En réponse au message Apache::ParseLog Et le parsing de log apache. Évalué à 1.

    Wep, je sais j'ai pas donner bcp d'info ... en voila :)

    dans le httpd.conf :
    -----
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %v" full
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    CustomLog /var/log/apache/access.log combined


    mon code :
    ----------------

    #!/usr/bin/perl
    use Apache::ParseLog;

    $conf = "/etc/apache/httpd.conf";
    $base = new Apache::ParseLog($conf);
    $base->config([%fields]);
    $tr=$base->getCustomLog("combined");
    if($tr==0)
    {
    print "null";
    exit;
    }
    %hit = $tr->hitbydate();
    foreach (sort keys %hit) {
    print "$_:\t$hitbydate{$_}\n"; # <date>: <hit counts>
    }
    exit;