HSL -logging various HTTP::Header values

Hi, i am trying to capture the “X-Forwarded-For” and other header info in this High Speed Logging iRule but not sure if it’s going to work.

when CLIENT_ACCEPTED {

set hsl [HSL::open -proto UDP -pool syslog_server_pool] }

when HTTP_REQUEST {

if { [HTTP::header exists “Content-Length”]} {

HSL::send $hsl “<190> Virtual: [virtual name], IP: [IP::client_addr], Method: [HTTP::method], XFF: [HTTP::header X-Forwarded-For], Content-Type: [HTTP::header Content-Type], Content-length: [HTTP::header Content-Length] for [HTTP::uri]”

}

}

thanks!

Based on what I can find on the iRules wiki, it looks good, although you may want a \n at the end of your text.

Thanks WLB!

You’re welcome. Has it worked then?

You could also use [HTTP::header values X-Forwarded-For] in case there are multiple XFF headers in the request.

Aaron