Forum Discussion

vmusacchio_3716's avatar
vmusacchio_3716
Icon for Nimbostratus rankNimbostratus
Sep 10, 2018

How can i add to this irule a part to know which pool is relationed with the virtual Server?

when CLIENT_ACCEPTED { set hsl [HSL::open -proto UDP -pool pl.logs01.stp]

} when HTTP_REQUEST { Save request information for later logging set req_start [clock clicks -milliseconds] set clientip [IP::client_addr] set method [HTTP::method] set uri [HTTP::uri] set referer [HTTP::header Referer] set ua [HTTP::header Usrer-Agent] } when HTTP_RESPONSE { set log_string "$clientip [clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"] [expr {[clock clicks -milliseconds] - $req_start}] \"$method $uri\" [HTTP::status] [HTTP::header Content-Length] \"$referer\" \"$ua\"" log local1.info $log_string
HSL::send $hsl $log_string

}

Can anyone tell my how can i add to this IRule the "pool" in which the Vritual server forwards the traffic?.

2 Replies

  • This document details the LB::server command which can be used to return pool names and members in the HTTP_REQUEST event:

     

    https://devcentral.f5.com/wiki/iRules.LB__server.ashx

     

    Being that this info will be in the client side context, you'll have to create a variable as you've done with the other client side commands in order to put it in the HTTP_RESPONSE server side context.

     

  • Hi,

    you can retrieve pool-member using this irule:

    when LB_SELECTED {
    log local0. "[LB::server addr] was the IP that was selected."
    }
    

    Regards