Forum Discussion

LA_Medina_32319's avatar
LA_Medina_32319
Icon for Nimbostratus rankNimbostratus
Apr 05, 2018

How to Log the HTTP/HTTPS request and response for specific URL

Hi,

Any one can give the iRule syntax to Log the HTTP/HTTPS request and response for a specific URL. Preferably with the client IP address.

From what i read it should be something like:

when HTTP_REQUEST {
   set uri [HTTP::uri]
   set host [HTTP::host]
}
when SERVER_CONNECTED {
   log local0. "[IP::client_addr]:[TCP::client_port] -> [IP::server_addr]:[TCP::server_addr] for http://$host$uri"
}
when LB_FAILED {
   log local0. "[IP::client_addr]:[TCP::client_port] -> FAILED for http://$host$uri"
}

Would appreciate if anyone can advise if the above syntax is correct and enough to achieve what we need. We just basically want to logs the https traffic.

1 Reply

  • Its all how you customize.

    when CLIENT_ACCEPTED {
    set client [IP::client_addr]
    log local0. "Client: $client has established a connection"      
    }
    
    when HTTP_REQUEST {
    set client_info [IP::client_addr]:[TCP::client_port]
    set url [HTTP::header Host][HTTP::uri]
    log local0. "Client Source IP: $client_info is requesting URL: $url " 
    }
    
    
    when SERVER_CONNECTED {
    set pool_name [LB::server pool]
    log local0. "Client Source IP: [IP::client_addr]:[TCP::client_port] <--> POOL : $pool_name <--> ACTUALNODE <--> [IP::server_addr]:[TCP::server_port]" 
    }