Forum Discussion

R_Marc_77962's avatar
R_Marc_77962
Icon for Nimbostratus rankNimbostratus
Jan 11, 2016

Force iRule to recompile

Is there any way to force an iRule on a virtual to recompile on a pooled connection? I'm trying to implement some on the fly debugging capabilities (header logging and so forth) but the virtuals in question are used by JVMs which create connection pools to the virtual.

 

1 Reply

  • Hi Marc,

     

    there is no build-in option to force an already established connections to use your updated iRules.

     

    https://support.f5.com/kb/en-us/solutions/public/13000/200/sol13253.html

     

    But you could implement some on-the-fly debug hooks using various coding techniques...

     

    Example1: Using a static debug hook with options to enable/disable your debug code on-the-fly

     

    when RULE_INIT {
        set static::debug_hook_enable 1
        set static::debug_logging_enable 1
    }
    when HTTP_REQUEST {
        if { $static::debug_hook_enable } then {
             Place your static debugging code here
        }
        if { $static::debug_logging_enable } then { log -noname local0.debug "DebugLog: [HTTP::uri] etc." }
    
         Place your regular iRule code here
    }

    Example2: Using a variable based debug hook with support to enable/disable/change the contained code on-the-fly

     

    when RULE_INIT {
        set static::debug_hook_enable 1
        set static::debug_hook_code {
             Place your dynamic debugging code here
            
             Caution: The code insert here is not iControl checked for validity. Coding error would imediately kill every active session.
        }
    }
    when HTTP_REQUEST {
        if { $static::debug_hook_enable } then {
            eval $static::debug_hook_code
        }
         Place your regular iRule code here
    }

    Example3: Using a procedure based debug hook with support to enable/disable/change the contained code on-the-fly

     

    when RULE_INIT {
        set static::debug_hook_enable 1
    }
    when HTTP_REQUEST {
        if { $static::debug_hook_enable } then {
            eval [call DEBUG_PROC]
        }
         Place your regular iRule code here
    }
    proc DEBUG_PROC {} { return {
         Place your dynamic debugging code here
        
         Caution: The code insert here is not iControl checked for validity. Coding error would imediately kill every active session.
    }}

    Note: Example2 or Example3 should be used with caution, since I haven't seen F5 employees to use/recomment/disagree this technique.

     

    Cheers, Kai