Menu

exclude_hosts works incorrect!

sarg
2005-03-28
2012-12-19
  • Vasiliy Kotikov

    Vasiliy Kotikov - 2005-03-28

    Hello,

    If exclude_hosts file is defined, sarg counts does not exclude but it include the last line of the file.
    version 2.0.5

     
    • ZaRaZ

      ZaRaZ - 2005-04-20

      Why exclude_hosts did not works after resolve ip?

       
    • savelyalex

      savelyalex - 2005-05-18

      Та же хрень. Версия 2.0.7

       
    • Vasiliy Kotikov

      Vasiliy Kotikov - 2005-05-20

      Da uzh... net smysla perehodit :-(

       
    • savelyalex

      savelyalex - 2005-06-02

      Still does not work. Version 2.0.8. Why ???

       
      • Pedro Lineu Orso

        please, le me know whatss really happening, cause I cant find any errors...
        How do you use it? Pls send your sarg.conf and exlude_hosts file to me: orso@brturbo.com.br

        Thanks

         
    • sopres

      sopres - 2005-06-06

      exclude_hosts used to work here with a 1.4.1 version, but with 2.0.6 they are no longer excluded from the stats ...

       
    • Vasiliy Kotikov

      Vasiliy Kotikov - 2005-06-06

      If a file's "exclude_hosts" last line has no records, the stat - empty( no records )
      If it has specified 192.168.40.0 without return carrier - the stat includes only last network!

      configs and screenshot are sent by emal

       
    • Artie

      Artie - 2005-06-09

      Dear Pedro,
      will anything be fixed with this bug?

      exclude_hosts are simply ignored in new versions

       
      • Pedro Lineu Orso

        I need more detais because in my tests everythink works ok.

        Please, send to orso@brturbo.com.br your sarg.conf file and your exclude file. I will release a fix.

        Thanks
        Pedro Orso

         
    • Pedro Lineu Orso

      please apply this patch in sarg-2.08 and let me know if works fine for you. http://sarg.sourceforge.net/excludehost.patch.gz

      patch -p0 < excludehosts.patch
      make install

      Thanks
      Pedro Orso

       
    • sopres

      sopres - 2005-06-28

      bmix.80> nus patch -p0 < excludehost.patch
        Looks like a unified context diff.
      Hunk #1 failed at line 1076.
      Hunk #2 failed at line 32.
      2 out of 2 hunks failed: saving rejects to log.c.rej
      done

      bmix.81> cat log.c.rej
      ***************
      *** 1076,1084 ****
                       l=1;else l=0;
                 }
                   if(fhost) {
      -               l=vhexclude(excludefile,ip);
      -               if(l) l=vhexclude(excludefile,url);
                      if(!l)
                       totregsx++;
                   }
      - -- exclude.c  2005-06-15 10:06:34.000000000 -0300
      --- 1076,1084 ----
                       l=1;else l=0;
                 }
                   if(fhost) {
      + //              l=vhexclude(excludefile,ip);
      +               l=vhexclude(excludefile,url);
                      if(!l)
                       totregsx++;
                   }
      + ++ new/exclude.c      2005-06-15 10:06:24.000000000 -0300
      ***************
      *** 32,59 ****
           char wip1[1024], wip2[1024];
           char sn1[4], sn2[4], sn3[4];
           char str[strlen(excludefile)];

           whost[0]='\0';
           strcpy(str,excludefile);
           getword(whost,str,' ');
      -
           while(strcmp(whost,"*FIM*") != 0) {
              if(strcmp(ip,whost) ==0)
                 return(0);

      -       strcpy(wip1,ip);
      -       getword(sn1,wip1,'.');
      -       getword(sn2,wip1,'.');
      -       getword(sn3,wip1,'.');
      -
      -       sprintf(wip1,"%s.%s.%s.0",sn1,sn2,sn3);
      -       sprintf(wip2,"%s.%s.0.0",sn1,sn2);
      -
      -       if(strstr(whost,wip1) !=0)
      -          return(0);
      -
      -       if(strstr(whost,wip2) !=0)
      -          return(0);

              getword(whost,str,' ');
           }
      --- 32,58 ----
           char wip1[1024], wip2[1024];
           char sn1[4], sn2[4], sn3[4];
           char str[strlen(excludefile)];
      +    char *num=ip;

           whost[0]='\0';
           strcpy(str,excludefile);
           getword(whost,str,' ');
      +
      +
           while(strcmp(whost,"*FIM*") != 0) {
              if(strcmp(ip,whost) ==0)
                 return(0);

      +       if(isdigit(num[0])) {
      +          strcpy(wip1,ip);
      +          getword(sn1,wip1,'.');
      +          getword(sn2,wip1,'.');
      +          getword(sn3,wip1,'.');
      +          sprintf(wip1,"%s.%s.%s.0",sn1,sn2,sn3);
      +          sprintf(wip2,"%s.%s.0.0",sn1,sn2);
      +          if(strstr(wip1,whost) !=0) return(0);
      +          if(strstr(wip2,whost) !=0) return(0);
      +       } else if(strstr(ip,whost) != 0) return(0);

              getword(whost,str,' ');
           }

      :(((((

       
    • Vasiliy Kotikov

      Vasiliy Kotikov - 2005-07-02

      Hello!

      I have tried the patch but still I get in stat hosts which are supposed to be excluded. Ex.: 127.0.0.1 and localhost and etc.
      Files: squid.log, generated statistics pages, built rpm, src, sarg config files... are available for download from http://ftp.mstuca.ru/sarg
      Please, check these files (maybe my configuration is wrong?), I really hope they help!

      Thank You
      Vasiliy Kotikov

       
    • Vasiliy Kotikov

      Vasiliy Kotikov - 2005-07-02

      Maybe exclude hosts means only the URL which can be http://192.168.40.5 or http://destination.host.address.com, doesn't it ?
      But does not exclude from the stats the source (client) IP address ?
      In this situation, exclude_hosts (patch) works!

      Thank You

       
    • Michael Bordignon

      I'm having the same problem, with both 2.0.5 and 2.0.8, on Debian Sarge. Will try the patch now and let you know how I get on

       
    • Michael Bordignon

      Patch works well, thanks.

       

Log in to post a comment.