F5 - IRule HTTP Header Logging

 

IRule For HTTP header logging

 

This iRule logs all HTTP headers


when RULE_INIT {
 set static::debug 1
}

when HTTP_REQUEST {
 if { $static::debug != 0 } {
   set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]"
   log local0. "============================================="
   log local0. "$LogString (request)"
   foreach aHeader [HTTP::header names] {
      log local0. "$aHeader: [HTTP::header value $aHeader]"
   }
   log local0. "============================================="
 }
}
when HTTP_RESPONSE {
 if { $static::debug != 0 } {
   log local0. "============================================="
   log local0. "$LogString (response) - status: [HTTP::status]"
   foreach aHeader [HTTP::header names] {
      log local0. "$aHeader: [HTTP::header value $aHeader]"
   }
   log local0. "============================================="
 }
}