Forum Discussion
Filtering client IP using HSL in irules
when HTTP_REQUEST {
set hsl [HSL::open -proto UDP -pool SYSLOG_POOL] set http_request_time [clock clicks -milliseconds] HTTP::collect 4096 set LogString "<190> [IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port]; [HTTP::host]"
host header translation function
HSL::send $hsl "$LogString REQUEST HOST HEADER TRANSLATED -----> [HTTP::host]"
}
when HTTP_RESPONSE {
set hsl [HSL::open -proto UDP -pool SYSLOG_POOL] HSL::send $hsl "[IP::client_addr]:[TCP::client_port]->[IP::local_addr]:[TCP::local_port] RESPONSE FROM SERVER ---> [LB::server])"
}
1 Reply
Enclose the logic in an if statement:
if { [IP::addr [IP::client_addr] equals 1.2.3.4] } { execute existing code }Make sure to do it in both events and you should be fine.
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com