Outils pour utilisateurs

Outils du site


linux:awstats (lu 527 fois)

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
linux:awstats [19-04-2018 10:42]
edmc73
linux:awstats [09-01-2020 16:55]
edmc73 [Configuration pour Postfix]
Ligne 183: Ligne 183:
 ou ou
   /usr/lib/cgi-bin/awstats.pl -config=postfix -update     /usr/lib/cgi-bin/awstats.pl -config=postfix -update  
 +  
 +===== Bug avec les requêtes en timeout HTTP 408 =====
 +
 +Un vieux bug jamais résolu qui fait raler awstats lorsqu'un log est issue d'un timeout avec un code http 408
 +<code>
 +Error while processing /etc/awstats/awstats.xxx.conf
 +Create/Update database for config "/etc/awstats/awstats.xxx.conf" by AWStats version 7.6 (build 20161204) From data in log file "/var/log/apache2/xxx_access.log"...
 +Phase 1 : First bypass old records, searching new record...
 +Direct access after last parsed record (after line 182) AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
 +Your log file /var/log/apache2/xxx_access.log must have a bad format or LogFormat parameter setup does not match this format.
 +Your AWStats LogFormat parameter is:
 +1
 +This means each line in your web server log file need to have "combined log format" like this:
 +111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
 +And this is an example of records AWStats found in your log file (the record number 50 in your log):
 +192.168.37.151 - - [09/Jan/2020:16:30:42 +0100] "-" 408 3277 "-" "-"
 +Setup ('/etc/awstats/awstats.xxx.conf' file, web server or permissions) may be wrong.
 +Check config file, permissions and AWStats documentation (in 'docs' directory).
 +
 +</code>
 +
 +La seule solution que j'ai trouvé, est de modifier le code d'awstats. Malheureusement, à chaque upgrade du paquet, la modif sautera mais bon... ça m'évite de recevoir un mail toutes les 10min...
 +
 +localisez votre fichier puis modifiez le
 +
 +  # locate awstats.pl
 +  /usr/lib/cgi-bin/awstats.pl
 +  # vi /usr/lib/cgi-bin/awstats.pl
 +
 +Vers la ligne 8977, modifier le regex par 
 +  "([^ ]+) [^ ]+ ([^\\/\\[]+) \\[([^ ]+) [^ ]+\\] \\\"(?:-|([^ ]+) ([^ ]+)(?: [^\\\"]+|))\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*?)\\\" \\\"([^\\\"]*)\\\"";
 +
 +Dans le code ci-dessous, j'ai mis en commentaire le regex original juste après, on peut voir qu'un autre regex était déjà en commentaire dans le code d'origine juste avant, ce qui montre que ce point semble non maîtrisé par les développeurs
 +  
 +<code perl>
 +  if ($Debug) {
 +    debug(
 +"Call To DefinePerlParsingFormat (LogType='$LogType', LogFormat='$LogFormat')"
 +    );
 +  }
 +  if ( $LogFormat =~ /^[1-6]$/ ) {    # Pre-defined log format
 +    if ( $LogFormat eq '1' || $LogFormat eq '6' )
 +    { # Same than "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"".
 +       # %u (user) is "([^\\/\\[]+)" instead of "[^ ]+" because can contain space (Lotus Notes). referer and ua might be "".
 +
 +# $PerlParsingFormat="([^ ]+) [^ ]+ ([^\\/\\[]+) \\[([^ ]+) [^ ]+\\] \\\"([^ ]+) (.+) [^\\\"]+\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*?)\\\" \\\"([^\\\"]*)\\\"";
 +      $PerlParsingFormat =
 +"([^ ]+) [^ ]+ ([^\\/\\[]+) \\[([^ ]+) [^ ]+\\] \\\"(?:-|([^ ]+) ([^ ]+)(?: [^\\\"]+|))\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*?)\\\" \\\"([^\\\"]*)\\\"";
 +#"([^ ]+) [^ ]+ ([^\\/\\[]+) \\[([^ ]+) [^ ]+\\] \\\"([^ ]+) ([^ ]+)(?: [^\\\"]+|)\\\" ([\\d|-]+) ([\\d|-]+) \\\"(.*?)\\\" \\\"([^\\\"]*)\\\"";
 +
 +      $pos_host    = 0;
 +      $pos_logname = 1;
 +      $pos_date    = 2;
 +      $pos_method  = 3;
 +      $pos_url     = 4;
 +      $pos_code    = 5;
 +      $pos_size    = 6;
 +      $pos_referer = 7;
 +      $pos_agent   = 8;
 +      @fieldlib    = (
 +        'host', 'logname', 'date', 'method', 'url', 'code',
 +
 +
 +</code>
linux/awstats.txt · Dernière modification: 09-01-2020 16:55 de edmc73