Forum Discussion

Nazir_52641's avatar
Apr 05, 2017

Known limitation of HSL with proc

Hi,

 

We have iRules in which we log using HSL. If log servers are down we log locally. We wanted to convert HSL logging to proc so that instead of writing these many lines of code just for logging we can use a proc. Is there any known of using HSL with proc.

 

when CLIENT_ACCEPTED {

set hsl [HSL::open -publisher $static::log_publisher]

if { $log_hsl == 1 } {

    if {[active_members hsl_pool] < 1 ] } {
        log local0.info "Accepted client conn [IP::client_addr]:[TCP::client_port]"
    } else {
        HSL::send $hsl "$CLIENT_ACCEPTED_INFO Accepted client conn [IP::client_addr]:[TCP::client_port]"
    }
} else {
    log local0.info "Accepted client conn [IP::client_addr]:[TCP::client_port]"
}
}

Thanks Syed Nazir

 

5 Replies

  • I am not aware of any limitation/problem with log and procedures. However, be aware that is just another iRule. So, if you update the procedure, you need to reload all iRules that reference that procedure. Basically, just change something in the iRule and that will trigger a rule_init event.

     

  • uzair's avatar
    uzair
    Icon for Nimbostratus rankNimbostratus

    Is it ok to use HSL::open in procedure? Considering heavy iRule logging. My idea is to pass only the log string to proc. Rest HSL operation will be taken care by procedure.Will this cause any issue.

     

    • Leonardo_Souza's avatar
      Leonardo_Souza
      Icon for Cirrocumulus rankCirrocumulus

      I don't see any problem, but you need to try.

       

      Think about a procedure like a part of the code that is shared between multiple iRules.

       

      When the iRule call that code, it executes the code, like if it was in the iRule itself.

       

  • Is it ok to use HSL::open in procedure? Considering heavy iRule logging. My idea is to pass only the log string to proc. Rest HSL operation will be taken care by procedure.Will this cause any issue.

     

    • Leonardo_Souza's avatar
      Leonardo_Souza
      Icon for Cirrocumulus rankCirrocumulus

      I don't see any problem, but you need to try.

       

      Think about a procedure like a part of the code that is shared between multiple iRules.

       

      When the iRule call that code, it executes the code, like if it was in the iRule itself.