Irule for Redirection

Please help me with the irule to redirect the traffic based on specific URI to a pool-1 else (All other traffic)redirect to Pool-2. Along with iRule should log the information(Source and destination) in Logs

iRule for pool redirection is mentioned below: when HTTP_REQUEST { if { [HTTP::uri] starts_with “/abc” } { pool pool1 } elseif { pool pool2 } }

You can log client IP using below irule

when CLIENT_ACCEPTED { log local0. “[virtual] - client ip=[IP::client_addr]” }

This is for server end connection:

when SERVER_CONNECTED {

log local0. “Source IP address for connection to node: [getfield [IP::local_addr] “%” 1]”

}

LOG SOURCE AND DEST. IP

when HTTP_RESPONSE { log local0. “The Client IP address is [clientside {IP::remote_addr}] is connected with Server IP is [serverside {IP::remote_addr}]” }

OR, (BOTH ARE DIFFERENT BASED ON EVENT AND APPLICATION)

when SERVER_CONNECTED { log local0. “The Client IP address is [clientside {IP::remote_addr}] is connected with Server IP is [serverside {IP::remote_addr}]” }

It is worth noting that simple iRule logic like can can now be achieved using Local Traffic Policies in the GUI. These may be easier for teams without much iRule knowledge - Profiles are also less expensive from a performance perspective than iRules. However you obviously lack the granularity of iRules.