Forum Discussion

TMcGov_92811's avatar
TMcGov_92811
Icon for Nimbostratus rankNimbostratus
Jan 29, 2009

Help with simple iRule to log client IP

Hi, I wish to create an IRule that can be used in troubleshooting issues with particular source IPs. It would be applied to a VS only during troubleshooting. Specifically I want to match on a source IP, then log only that session in terms of selected pool and member. The "log" section works fine under SERVER_CONNECTED, but when I add the "if" statement I get syntax error messages.

 

 

when SERVER_CONNECTED {

 

if {[IP::client_addr] equals 10.10.10.10} {

 

log local0. "Client Source IP: [IP::client_addr]:[TCP::client_port]<-->POOL<-->[LB::server]<-->ACTUALNODE<-->[IP::server_addr]:[TCP::server_port]"

 

}

 

}

 

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The syntax looks pretty close. You'll want to use the IP::addr command, but that shouldn't cause the syntax error. What error are you getting?

    The result should look like:

     
     when SERVER_CONNECTED { 
       if { [IP::addr [IP::client_addr] equals 10.10.10.10] } { 
         log local0. "Client Source IP: [IP::client_addr]:[TCP::client_port]<-->POOL<-->[LB::server]<-->ACTUALNODE<-->[IP::server_addr]:[TCP::server_port]" 
       } 
     }  
     

    Colin