Forum Discussion

NielsL_243479's avatar
Icon for Nimbostratus rankNimbostratus
Mar 14, 2016

iRule: How to log the HTTP status code for a response from cache?

I'm working on an iRule that logs traffic to an ElasticSearch cluster. One of the items that I want to log, is the HTTP status code. When requests are served by a backend server, I can access the status in the HTTP_RESPONSE_RELEASE phase via the [HTTP::status] variable.


However, if the object is served from the F5 cache, this doesn't work:


Mar 14 11:53:24 slot1/_______ err tmm[8607]: 01220001:3: TCL error: /Common/____  - Illegal argument. Invalid client side API (line 4)     invoked from within "HTTP::status"

I already figured out that I can access most HTTP headers in the CACHE_RESPONSE phase via [CACHE::headers], but this does not include the HTTP status. Also, in this phase, [HTTP::status] does not work:


01070151:3: Rule [/Common/___] error: /Common/___:67: error: [command is not valid in current event context (CACHE_RESPONSE)][HTTP::status]

How can I log the status code from the cached response?


3 Replies

  • Hi,


    unfortunately this is not yet possible. I had the same issue when reporting HTTP requests using HSL.


    I have raised a case with F5 and F5 Product Development has filed a Feature Request ID537539 to include status code when content is being served out of RamCache.


    This is supposed to be implemented in some upcoming release.


    • Hendel's avatar
      Icon for Nimbostratus rankNimbostratus

      Find myself needing the same thing now in 2023 - don't suppose there's been a workaround added for this in the last decade(ish)?