Forum Discussion
Is there any known impacts of HSL with PROC support ?
Hi Nasir,
there are no known incompatibilities, when using HSL or LOG in combination with TCL procedures.
But as already pointed out by Niels, using TCL procedures is in general not a good choice if performance is a concern. The reason for that is that the execution of a procedures always requires additional CPU cycles to setup and maintain a child execution level and to map variables between the different execution levels.
Performancewise its almost always more effective to store a tailordered TCL script within a $static::variable during RULE_INIT and then [eval] this script every time you need to write a log entry.
Take a look to the [eval] based syntax below, to see how you could max out the performance of your HSL logging capability without sacrifying the overall usability...
iRule: GLOBAL_HSL_LOGGING
when RULE_INIT {
log local0.info "iRule Initialization"
Global configuration options
set static::log_enabled 1
set static::log_hsl_enabled 1
set static::log_hsl_publisher "/Common/HSLPublisher"
set static::log_hsl_pool "pool_hsl_logging"
Precompiling a TCL script for HSL logging
if { $static::log_hsl_enabled } then {
HSL logging is globally enabled...
set static::tcl_logging_script "
if \{ ( \[active_members $static::hsl_pool\] > 0 ) \} then \{
HSL::send \$hsl \"[info hostname] \$log_level tmm\[TMM::cmp_unit\] : Rule \$log_rule_name \$log_rule_event : \$log_message\"
\} else \{
log -noname \"local0.\$log_level\" \"Rule \$log_rule_name \$log_rule_event : \$log_message\"
\}
"
} else {
HSL logging is globally disabled...
set static::tcl_logging_script "
log -noname \"local0.\$log_level\" \"Rule \$log_rule_name \$log_rule_event : \$log_message\"
"
}
}
iRule: YOUR_APPLICATION_SPECIFIC_IRULE
when CLIENT_ACCEPTED {
iRule specific configuration options
set log_rule_name "testRule1"
Event specific configuration options
set log_rule_event "CLIENT_ACCEPTED"
Initialize HSL logging for this TCL connection
if { $static::log_hsl_enabled } then { set hsl [HSL::open -publisher $static::log_publisher] }
Your iRule code...
if { $static::log_enabled } then { set log_level "debug" ; set log_message "CALL_FLOW Client \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]" ; eval $static::tcl_logging_script }
}
when CLIENT_CLOSED {
Event specific configuration options
set rule_event "CLIENT_CLOSED"
Your iRule code...
if { $static::log_enabled } then { set log_level "info" ; set log_message "CALL_FLOW Client \[[IP::client_addr]:[TCP::client_port]\]==>F5 \[[IP::local_addr]_[TCP::local_port]\]" ; eval $static::tcl_logging_script }
}
Cheers, Kai
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com