Forum Discussion

Angelo's avatar
Angelo
Icon for Nimbostratus rankNimbostratus
Aug 01, 2012

Logging not working...

this is the irule i have but the I'm not getting hits on logging....

 

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri]] {

 

"/SolutionSORB*" {

 

pool pool_sorb_domain

 

}

 

"/ServiceSORB*" {

 

pool pool_sorb_domain

 

}

 

"/ServiceFileProcessor*" {

 

pool pool_sorb_domain

 

}

 

"/ServiceInstalledBase*" {

 

pool pool_sorb_provisioning_domain

 

}

 

Default { reject }

 

}

 

}

 

when HTTP_RESPONSE {

 

log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port] | pool: [LB::server pool]"

 

}

 

 

 

 

4 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Assuming you've checked the obvious bits like is the iRule saving correctly and there's no errors in /var/log/ltm saying it's getting TCL exceptions...

     

     

    Also check for errors in the ltm log saying things like

     

     

     

    The requested GTM rule (/Common/director-save-members-v001) already exists in partition Common.

     

     

     

     

     

    (The important part is the 'already exists' for your iRule. If you see this the side effect is that your updates don't get loaded. An OLD version of the script will keep executing).

     

     

     

     

     

    If all that passes, does the iRule ever get run? Do you see the counters incrementing in the iRule stats for the event?

     

     

    H

     

     

  • Angelo, if all else fails I've found that in certain high-traffic cases committing an irule does not immediately see it applied to all incoming traffic, and I've had to configsync the pair for it to be picked up across the board.
  • Also, just FYI the HTTP_REQUEST section of your code will never work. You're looking at the lower-cased version of [HTTP::uri], but your switch cases contain capital letters.

     

     

    Actually, I suspect this is why you're not seeing any logging. Your default will always hit, which is "reject", so no one will ever have an HTTP_RESPONSE event occur.

     

     

     

     

    And furthermore, you can use switch fall-through to avoid having "pool pool_sorb_domain" in multiple switch blocks, like so:

     

     

    
      switch -glob [string tolower [HTTP::uri]] { 
        "/SolutionSORB*" -
        "/ServiceSORB*" -
        "/ServiceFileProcessor*" { pool pool_sorb_domain }
    ...
    

     

     

    The - after the first and second cases indicate to the switch that it should perform the action for the next case, as if it had matched there. It will "fall through" multiple dashes, so you only need to put that pool pool_sorb_domain once.
  • I think the issue is that you're setting the URI to lowercase for the switch, but checking URIs which are mixed case.

     

     

    Also, make sure to select a pool in all cases if you select a pool in the iRule in one case. Or add a OneConnect profile. Either step ensures the URI to pool mapping is done per HTTP request as you expect it to be done.

     

     

    Aaron