Forum Discussion

jonathan_b_2522's avatar
jonathan_b_2522
Icon for Nimbostratus rankNimbostratus
Aug 29, 2017

iRule to record GET(response) data size in bytes

We are seeing resources spike due to some web scraping. I created an iRule to log each of the connections, and I've been able to see top talkers by number of connections, but I'm looking for an easy way to see top talkers according to GET size in bytes,kilobytes, etc. Any ideas? Here is my current log iRule.

 

when HTTP_REQUEST { log local0. "clientIP:[IP::client_addr] accessed [HTTP::host][HTTP::uri]" }

 

1 Reply

  • Hello Jonathan,

    Try this irule :

    when HTTP_REQUEST {
    
    set client_ip [IP::client_addr]
    set host [HTTP::host]
    set uri [HTTP::uri]
    
    }
    
    when HTTP_RESPONSE {
    
    set content_length [HTTP::header "Content-Length"]
    log local0. "Request => clientIP:$client_ip accessed $host $uri  Response => [HTTP::status] Content-length $content_length bytes"
    
    }
    

    Hope it helps

    Please give me a feedback