(self, varnihslog_data,
                                                     x_varnish_reference_list)
Utility to parse such string:

      14 ReqStart     c 127.0.0.1 58470 385643239
      14 RxRequest    c GET
      14 RxURL        c /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/ga/account/
      14 RxProtocol   c HTTP/1.1
      14 RxHeader     c Host: 127.0.0.1:6081
      14 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100110 Mandriva Linux/1.9.1.7-0.1mdv2010.0 (2010.0) Firefox/3.5.7
      14 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      14 RxHeader     c Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
      14 RxHeader     c Accept-Encoding: gzip,deflate
      14 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      14 RxHeader     c Referer: http://www.example.com/
      14 RxHeader     c If-Modified-Since: Thu, 25 Feb 2010 16:22:23 GMT
      14 RxHeader     c Via: 1.1 www.example.com
      14 RxHeader     c X-Forwarded-For: 82.226.226.226
      14 RxHeader     c X-Forwarded-Host: www.example.com
      14 RxHeader     c X-Forwarded-Server: www.example.com
      14 RxHeader     c Connection: Keep-Alive
      14 VCL_call     c recv
      14 VCL_return   c lookup
      14 VCL_call     c hash
      14 VCL_return   c hash
      14 VCL_call     c miss
      14 VCL_return   c fetch
      14 Backend      c 15 default default
      15 TxRequest    b GET
      15 TxURL        b /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/ga/account/
      15 TxProtocol   b HTTP/1.1
      15 TxHeader     b Host: 127.0.0.1:6081
      15 TxHeader     b User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100110 Mandriva Linux/1.9.1.7-0.1mdv2010.0 (2010.0) Firefox/3.5.7
      15 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      15 TxHeader     b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      15 TxHeader     b Referer: http://www.example.com/
      15 TxHeader     b Via: 1.1 www.example.com
      15 TxHeader     b X-Forwarded-For: 82.226.226.226
      15 TxHeader     b X-Forwarded-Host: www.example.com
      15 TxHeader     b X-Forwarded-Server: www.example.com
      15 TxHeader     b X-Varnish: 385643239
      15 TxHeader     b X-Forwarded-For: 127.0.0.1
      16 SessionOpen  c 127.0.0.1 58471 :6081
      16 ReqStart     c 127.0.0.1 58471 385643240
      16 RxRequest    c GET
      16 RxURL        c /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/erp5_web_example_layout.css
      16 RxProtocol   c HTTP/1.1
      16 RxHeader     c Host: 127.0.0.1:6081
      [...]

    This script is able to know if the request goes to the backend or not according ID of request
    ie: 385643239
    if we are able to read such string "TxHeader     b X-Varnish: 385643239"
    means varnish send a query to the backend.
Utility to parse such string:
Utility to parse such string :
def _readVarnishLogAndGetIsBackendTouched(self, varnihslog_data,
                                                     x_varnish_reference_list):
    """Utility to parse such string:

      14 ReqStart     c 127.0.0.1 58470 385643239
      14 RxRequest    c GET
      14 RxURL        c /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/ga/account/
      14 RxProtocol   c HTTP/1.1
      14 RxHeader     c Host: 127.0.0.1:6081
      14 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100110 Mandriva Linux/1.9.1.7-0.1mdv2010.0 (2010.0) Firefox/3.5.7
      14 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      14 RxHeader     c Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
      14 RxHeader     c Accept-Encoding: gzip,deflate
      14 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      14 RxHeader     c Referer: http://www.example.com/
      14 RxHeader     c If-Modified-Since: Thu, 25 Feb 2010 16:22:23 GMT
      14 RxHeader     c Via: 1.1 www.example.com
      14 RxHeader     c X-Forwarded-For: 82.226.226.226
      14 RxHeader     c X-Forwarded-Host: www.example.com
      14 RxHeader     c X-Forwarded-Server: www.example.com
      14 RxHeader     c Connection: Keep-Alive
      14 VCL_call     c recv
      14 VCL_return   c lookup
      14 VCL_call     c hash
      14 VCL_return   c hash
      14 VCL_call     c miss
      14 VCL_return   c fetch
      14 Backend      c 15 default default
      15 TxRequest    b GET
      15 TxURL        b /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/ga/account/
      15 TxProtocol   b HTTP/1.1
      15 TxHeader     b Host: 127.0.0.1:6081
      15 TxHeader     b User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100110 Mandriva Linux/1.9.1.7-0.1mdv2010.0 (2010.0) Firefox/3.5.7
      15 TxHeader     b Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      15 TxHeader     b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      15 TxHeader     b Referer: http://www.example.com/
      15 TxHeader     b Via: 1.1 www.example.com
      15 TxHeader     b X-Forwarded-For: 82.226.226.226
      15 TxHeader     b X-Forwarded-Host: www.example.com
      15 TxHeader     b X-Forwarded-Server: www.example.com
      15 TxHeader     b X-Varnish: 385643239
      15 TxHeader     b X-Forwarded-For: 127.0.0.1
      16 SessionOpen  c 127.0.0.1 58471 :6081
      16 ReqStart     c 127.0.0.1 58471 385643240
      16 RxRequest    c GET
      16 RxURL        c /web/VirtualHostBase/http/www.example.com:80/erp5/web_site_module/example_website/VirtualHostRoot/_vh_/erp5_web_example_layout.css
      16 RxProtocol   c HTTP/1.1
      16 RxHeader     c Host: 127.0.0.1:6081
      [...]

    This script is able to know if the request goes to the backend or not according ID of request
    ie: 385643239
    if we are able to read such string "TxHeader     b X-Varnish: 385643239"
    means varnish send a query to the backend.
    """
    for x_varnish_reference in x_varnish_reference_list:
      backend_is_touched_regex = re.compile('TxHeader\s+b\sX-Varnish:\s%s' %\
                                                        x_varnish_reference[0])
      match_object = backend_is_touched_regex.search(varnihslog_data)
      backend_touched = match_object is not None
      logging.debug('%r %r' % (backend_touched, x_varnish_reference,))
      if backend_touched != x_varnish_reference[1]:
        if backend_touched:
          title = 'Error:Backend touched'
        else:
          title = 'Error Backend not touched'
        message = '%s -> X-Varnish:%r' % (title, x_varnish_reference,)
        self.report_dict.setdefault(x_varnish_reference[2],
                                    []).append(message)
def _readVarnishLogAndGetIsBackendTouched ( self , varnihslog_data , x_varnish_reference_list ) : for x_varnish_reference in x_varnish_reference_list : backend_is_touched_regex = re . compile ( 'TxHeader\s+b\sX-Varnish:\s%s' % x_varnish_reference [ 0 ] ) match_object = backend_is_touched_regex . search ( varnihslog_data ) backend_touched = match_object is not None logging . debug ( '%r %r' % ( backend_touched , x_varnish_reference , ) ) if backend_touched != x_varnish_reference [ 1 ] : if backend_touched : title = 'Error:Backend touched' else : title = 'Error Backend not touched' message = '%s -> X-Varnish:%r' % ( title , x_varnish_reference , ) self . report_dict . setdefault ( x_varnish_reference [ 2 ] , [ ] ) . append ( message )