Forum Discussion

helenio's avatar
helenio
Icon for Nimbostratus rankNimbostratus
Feb 26, 2014

local variable within same irule on all events

Hello,

 

I'd like to use a local variable to log all event within a certain irule.

 

Since now I have done like this:

 

when CLIENT_ACCEPTED { set logdebug 1 if {$logdebug != 0} {log local0.info "Client Connected, IP: [IP::client_addr], pool [LB::server pool]"} }

 

when HTTP_REQUEST { set logdebug 1 if {$logdebug != 0} {log local0.info "Client IP IP: [IP::client_addr], host [HTTP::host]"} }

 

when LB_SELECTED { set logdebug 1 if {$logdebug != 0} {log local0.info "in LB_SELECTED, IP [IP::client_addr]:[TCP::client_port], node [LB::server addr], pool [LB::server pool]"} }

 

But I'd like to avoid global variable and have to set logdebug to 1 only once on the irule ? Is that possible ? maybe with "session add " on the CLIENT_ACCPTED event ?

 

12 Replies