NielsL_243479
Mar 14, 2016Nimbostratus
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?