Forum Discussion

Ajinkya's avatar
Ajinkya
Icon for Altostratus rankAltostratus
May 06, 2021

How to log more specific traffic in irule

Hi All,   I need help in logging the irule traffic. I have i-rule, in which "switch" statement is used to redirect traffic to different pool. there are 100+ URIs used under this statement for r...
  • AlexBCT's avatar
    May 06, 2021

    Hi Ajinkya,

     

    I think the following should work:

     

    "/abg/127/abc.html" {

    pool HTTP_POOL_4

    log local0. "URI /abg/127/abc/html matched. Client IP [IP::client_addr]"

    }

     

    If you have a look here, there is a good explanation of the "switch" command, as well as some examples on what it can look like: https://clouddocs.f5.com/api/irules/switch.html

     

    Additionally, if you indeed have a 100+ entries in the switch statement, you may want to have a look at working with DataGroups, rather than the switch statement - it can improve performance quite a bit (if performance is a factor of course) You can find more info about this here: https://clouddocs.f5.com/api/irules/class.html

     

    Hope this helps.