Log Http Class Selection

Problem this snippet solves:

This iRule logs details of an HTTP request when the request is parsed and when the request matches or does not match an HTTP class filterset. It is a quick way to determine from the command line whether a request matched an HTTP class and if so, which class.

Code :

when HTTP_REQUEST {
   log local0.info "Client [IP::client_addr] -> [HTTP::host][HTTP::uri]"
}

when HTTP_CLASS_SELECTED {
   log local0.info "Client [IP::client_addr] -> [HTTP::host][HTTP::uri] went to [HTTP::class] HTTP class"
}

when HTTP_CLASS_FAILED {
   log local0.info "Client [IP::client_addr] -> [HTTP::host][HTTP::uri] did not match an HTTP class!"
}

# If the request matches any class, you should see two lines in the /var/log/ltm log file, with the second line listing the HTTP class that the request matched:

Jul 28 15

If the request doesn’t match a class, you will see one line logged for the HTTP request and a second for the HTTP_CLASS_FAILED event:

Jul 28 15

Jul 28 15
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment