In some cases, especially during troubleshooting it may be useful to create custom logging iRule to log information about requests to specific VIP.
Of course you could simply use “Request Logging” profile in LTM, but using iRule will allow you to tag logs so you can find specific requests easier and most importantly log more verbose information including headers.
Taking all the benefits in the account you still have to remember that using iRules and local logging on busy VIPs may be resource intensive so I would recommend to use it only when necessary and not on permanent basis,
You will retrieve Virtual Name, Method, Request and all request headers using iRule displayed below:
when HTTP_REQUEST { log local0. "Custom iRule LOG: VS Name: [virtual]" log local0. "Custom iRule LOG: Request: [HTTP::method] [HTTP::host][HTTP::uri]" foreach aHeader [HTTP::header names] { log local0. "Custom iRule LOG: $aHeader: [HTTP::header value $aHeader]" } }