Forum Discussion

muzammil_88686's avatar
muzammil_88686
Icon for Nimbostratus rankNimbostratus
Dec 24, 2012

URL Logging, Hitcount, IP addresses

Dear Dev Team,

 

We are getting complains from Server guys about some specific URLs are getting hit by lot of IP addresses and they are seeing lot of hits to those URLs.

 

The URLs are as below.

 

 

www.test.com/test?123*

 

www.test.com/test?xyz

 

www.test.com/test?abc

 

 

Could you pls help me in creating an iRule to find the below paramaters so that I can run it for few minutes to gather the information?

 

1) Number of hit counts for each URL

 

2) What are the IP addresses hitting each URL

 

 

Thank you in advance!

 

7 Replies

  • I'd suggest you are very careful using this to log the IP addresses as you may find your log files grows very quickly and the HSM may run out of disk space - use with care. This rule requires a Statistics Profile call busyurls and counters called 123, xyz and abc.

    
    when HTTP_REQUEST {
     switch -glob [string tolower [HTTP::uri]] {
       "/test?123*" {
        log local0. "[IP::client_addr] connected to [HTTP::host][HTTP::uri]"
        STATS::incr busyurls 123
       }
       "/test?xyz*" {
        log local0. "[IP::client_addr] connected to [HTTP::host][HTTP::uri]"
        STATS::incr busyurls xyz
       }
       "/test?abc*" {
        log local0. "[IP::client_addr] connected to [HTTP::host][HTTP::uri]"
        STATS::incr busyurls abc
        }
     }
    }
    
  • Thank you Steve for your response!

     

     

    If I want to capture only hit counts, what could be the iRule.

     

     

    BTW, even if it is only for hit counts still I need to create Statistics Profile.

     

  • You're welcome. Then it would be something like this, removing the log statements. Yes, you'd still need the Statistics Profile;

    
    when HTTP_REQUEST {
     switch -glob [string tolower [HTTP::uri]] {
       "/test?123*" {
        STATS::incr busyurls 123
       }
       "/test?xyz*" {
        STATS::incr busyurls xyz
       }
       "/test?abc*" {
        STATS::incr busyurls abc
        }
     }
    }
    
  • Good day,

     

    is there any global setting is the F5 to send all the HTTP and HTTPS hit logs to syslog ?

     

    Thank you

     

    • MSZ_221163's avatar
      MSZ_221163
      Icon for Nimbostratus rankNimbostratus

      Create a logging profile with all request then it will send the logs to the defined log server.

       

      Security --> Even Logs --> Logging Profile Add