Forum Discussion

Andrew_Nascimen's avatar
Andrew_Nascimen
Icon for Nimbostratus rankNimbostratus
Nov 12, 2019

Request logging - log backend server name

Referencing this document: https://techdocs.f5.com/kb/en-us/products/big-ip-aam/manuals/product/aam-concepts-11-6-0/30.html

 

I do not see an option for logging the backend server name that the request was dispatched to. Does the variable not exist? Or is it undocumented? If so, what is that variable?

 

I've tried $SERVER - which ocassionally returns the type of application server/version - eg. wildfly/10. I've tried SERVER_NAME (mirroring other structures and variables - CLIENT_IP, VIRTUAL_NAME, etc.) with no luck. And several other permutations.

 

Thanks,

 

Andrew

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    I had the same problem, looking to log the "Host:" header of the incoming request with the request logging profile. TAC advised me to use an irule instead for this purpose.

    • Andrew_Nascimen's avatar
      Andrew_Nascimen
      Icon for Nimbostratus rankNimbostratus

      JG, using request logging for the "Host" header is actually very straight forward. "$Host" will work.

       

      This is what my current request logging template looks like, json formatted:

       

      {"DATE":"$DATE_MM/$DATE_DD/$DATE_YY", "TIME":"$TIME_MSECS", "CIP":"$CLIENT_IP", "VIP":"$VIRTUAL_IP", "PORT":"$VIRTUAL_PORT", "BACKENDPOOL":"$VIRTUAL_POOL_NAME", "BACKENDSERVER":"$SERVER_IP", "BACKENDPORT":"$SERVER_PORT", "METHOD":"$HTTP_METHOD", "HOST":"$Host", "PATH":"$HTTP_PATH", "QUERY":"$HTTP_QUERY", "STATUS":"$HTTP_STATCODE", "REFERER":"$Referer", "USERAGENT":"${User-agent}", "SESSIONID":"${Cookie[SESSION]}", "XFF":"${X-Forwarded-For}", "LOCATION":"${Location}", "URI":"$HTTP_URI"}

       

      I historically have had issues with using an iRule for logging. It also means that I need to bind that iRule to every single VIP - which isn't as scalable as enabling a request logging profile with the default setting turned on.

       

      Hopefully, this helps you out.

      • JG's avatar
        JG
        Icon for Cumulonimbus rankCumulonimbus

        Are you sure it logs the "Host" header in the request and not the name of the F5 virtual server? To me, it seems it should be called something like "HTTP_HOST" instead. if it does work, it is certainly not documented for this profile of request logging, and F5 TAC knew nothing about it when I asked them.