Forum Discussion

Misty_Spillers's avatar
Misty_Spillers
Icon for Nimbostratus rankNimbostratus
Jun 01, 2017

Debugging a website irule help

I'm trying to debug a problem with a website. what's the best way to add a whitelist to not log things I know about? Like { [class match [string tolower [HTTP::uri]] starts_with "whitelist" ] } { don't log or no nothing. Here is my current rule:

when HTTP_REQUEST {
set hostvar [HTTP::host]
set urivar [HTTP::uri]
set ipvar [IP::client_addr] 
}
when HTTP_RESPONSE {
         if { ([HTTP::status] starts_with "4") || ([HTTP::status] starts_with "5")} {
                log local0. "$ipvar requested $hostvar $urivar and received a [HTTP::status] from [IP::server_addr]" }
}

Thanks for any help.

1 Reply

  • First, you need to understand what is the condition you will be testing, and also how many values you will have for testing.

     

    If just a small number of options, like up to 5, I would go for a switch. If a large number, I would go for a datagroup.

     

    You could also reverse that, and just log when you find that condition. That could be URL, client IP, etc...

     

    This links have information about the commands you need for switch and datagroup, and also examples with iRules using that:

     

    https://devcentral.f5.com/wiki/irules.switch.ashx

     

    https://devcentral.f5.com/wiki/irules.class.ashx