Forum Discussion

Javi_Lora's avatar
Javi_Lora
Icon for Altostratus rankAltostratus
Oct 18, 2023

iRule_LogFormatW3C goes into infinite loop

I have upgraded an instance of F5, we have moved to version FW BIG-IP 15.1.7 Build 0.0.6 Final and an iRule that sends the logs to a server enters an infinite loop that prevents the correct functioning of the Virtual.

We believe it is because the rule enters into an infinite blur in the new version.

The rule is:

***********************************************************************

when CLIENT_ACCEPTED {

# Open a new high speed logging connection to the syslog pool named syslog_server_pool
        set hsl [HSL::open -proto TCP -pool pool_iussllogs_514]

}
when HTTP_REQUEST priority 999 {
# Save request variables that are not accessible in HTTP_RESPONSE, like the URI, request method, etc
set req_start [clock clicks -milliseconds]
set cs_username [HTTP::username]
## set cs_uri_stem [HTTP::path]
## set cs_uri_query [HTTP::query]
## set cs_bytes [HTTP::header Content-Length]
## set ua [HTTP::header User-Agent]
## set cookies [HTTP::header values Cookie]
## set referer [HTTP::header Referer]
}
when HTTP_RESPONSE {

# Send the syslog message with a syslog facility of 142 (local1.info)
        #The number is constructed by multiplying the facility by 8 and then adding the level
# See the HSL wiki page for details on the facilties:
# https://devcentral.f5.com/wiki/iRules.HSL__send.ashx
#Obtenemos nodo destino
        set lb_server "[LB::server addr]:[LB::server port]"
        if { [string compare "$lb_server" ""] == 0 } {
          set lb_server "<forwarded>"
       }
# Replace null values with a hyphen:
# Use string map to replace a "tab space tab" with "tab hyphen tab"
HSL::send $hsl "[string map [list "\t \t" "\t-\t"]\
"<142> [info hostname]\t\
[IP::local_addr]\t\
[clock format [clock seconds] -format "%d/%m/%Y %H:%M:%S %z"]\t\
[IP::client_addr]\t\
$cs_username\t\
[clientside {IP::local_addr}]\t\
$cs_uri_stem\t\
$cs_uri_query\t\
[HTTP::status]\t\
[HTTP::header Content-Length]\t\
[expr {[clock clicks -milliseconds] - $req_start}]\t\
[HTTP::version]\t\
\"$ua\"\t\
$cookies\t\
$referer\t\
                Nodo:$lb_server\
"]\n"

}
*************************************************************
We did not find the problem, we only know that if we remove the iRule everything works correctly, but with the consequence that we do not receive the logs on the server.

Can you help us?

Thank you so much.

PS: Sorry if my English is not well structured.