Nazir_52641
Dec 05, 2016Cirrus
Is there any known impacts of HSL with PROC support ?
Hi All,
We are using HSL for remote logging but when all the HSL servers are down we are doing local logging.
Below is the existing iRule
when RULE_INIT {
upvar 0 tcl_platform static::tcl_platform
set static::log_publisher "/Common/HSLPublisher"
log local0.info "iRule Initialization"
set static::logging 0
set static::hsllogging 1
set static::rule_name "testRule1"
set static::hsl_pool "pool_hsl_logging"
}
when CLIENT_ACCEPTED {
set CLIENT_ACCEPTED_DEBUG "$static::tcl_platform(machine) debug tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_ACCEPTED:"
set CLIENT_ACCEPTED_INFO "$static::tcl_platform(machine) info tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_ACCEPTED:"
set hsl [HSL::open -publisher $static::log_publisher]
if { $static::logging == 1 } {
if { $static::hsllogging } {
if {[active_members $static::hsl_pool] < 1} {
log local0.debug "CALL_FLOW Client \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
else {
HSL::send $hsl "$CLIENT_ACCEPTED_DEBUG CALL_FLOW Client \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
} else {
log local0.debug "CALL_FLOW Client \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
} }
when CLIENT_CLOSED {
set CLIENT_CLOSED_DEBUG "$static::tcl_platform(machine) debug tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_CLOSED:"
if { $static::logging == 1 } {
if { $static::hsllogging } {
if {[active_members $static::hsl_pool] < 1} {
log local0.debug "CALL_FLOW CLient \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
else {
HSL::send $hsl "$CLIENT_CLOSED_DEBUG CALL_FLOW CLient \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
} else {
log local0.debug "CALL_FLOW CLient \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]"
}
}
}
For every one line of log we have to write 12 lines of code instead we are planning to use PROC.
Is there any known impact of PROC with HSL. We will have a separate PROC for each iRule below is the snippet
proc test_hsl { log_str hsl_log_str hsl_enable hsl_handler} {
if { ([active_members $static::hsl_pool] > 0) && ($hsl_enable) } {
HSL::send $hsl_handler $hsl_log_str
}
else {
log local0.info "$log_str"
}
}
when RULE_INIT {
upvar 0 tcl_platform static::tcl_platform
set static::log_publisher "/Common/HSLPublisher"
log local0.info "iRule Initialization"
set static::logging 0
set static::hsllogging 1
set static::rule_name "testRule1"
set static::hsl_pool "pool_hsl_logging"
}
when CLIENT_ACCEPTED {
set CLIENT_ACCEPTED_DEBUG "$static::tcl_platform(machine) debug tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_ACCEPTED:"
set CLIENT_ACCEPTED_INFO "$static::tcl_platform(machine) info tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_ACCEPTED:"
set hsl [HSL::open -publisher $static::log_publisher]
if { $static::logging == 1 } {
call test_hsl "$logStr" "$CLIENT_ACCEPTED_INFO $logStr" $static::hsllogging $hsl
}
}
when CLIENT_CLOSED {
set CLIENT_CLOSED_DEBUG "$static::tcl_platform(machine) debug tmm[TMM::cmp_unit]: Rule $static::rule_name CLIENT_CLOSED:"
if { $static::logging == 1 } {
call test_hsl "$logStr" "$CLIENT_CLOSED_INFO $logStr" $static::hsllogging $hsl
}
}