For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Schin122's avatar
Schin122
Icon for Nimbostratus rankNimbostratus
Feb 12, 2025

Connections log

I have added an irule to log inbound connections on a single VIP.  However, the data collected only includes the client IP address and the destination host name (below). 
 
----------------------------K03190044
when HTTP_REQUEST {
       log local0. "Client [IP::client_addr] request to [HTTP::host]"
}
--------------------------
 
I would like to expand the data collected to include: 
 
1. user_agant, 
2. uri_path 
3. wcw authentication cookie
 
Is there a simple way to expand the rule to include these parameters?
 
Thanks!
Sean

2 Replies

  • Hi Schin,

     

    Absolutely, you can expand your iRule to include the user agent, URI path, and a specific cookie.

    Here’s how you can modify your existing iRule to log these additional parameters:

    when HTTP_REQUEST {
        # Log client IP address and destination host name
        log local0. "Client [IP::client_addr] request to [HTTP::host]"
        
        # Log user agent
        set user_agent [HTTP::header "User-Agent"]
        log local0. "User-Agent: $user_agent"
        
        # Log URI path
        set uri_path [HTTP::uri]
        log local0. "URI Path: $uri_path"
        
        # Log wcw authentication cookie
        if { [HTTP::cookie exists "wcw_auth"] } {
            set wcw_cookie [HTTP::cookie "wcw_auth"]
            log local0. "WCW Auth Cookie: $wcw_cookie"
        } else {
            log local0. "WCW Auth Cookie: Not Present"
        }
    }

     

    Explanation of the Added Parameters
    User Agent:

    set user_agent [HTTP::header "User-Agent"]: Retrieves the User-Agent header from the HTTP request.
    log local0. "User-Agent: $user_agent": Logs the User-Agent value.

    URI Path:

    set uri_path [HTTP::uri]: Retrieves the URI path from the HTTP request.
    log local0. "URI Path: $uri_path": Logs the URI path.

    WCW Authentication Cookie:

    if { [HTTP::cookie exists "wcw_auth"] }: Checks if the "wcw_auth" cookie exists.
    set wcw_cookie [HTTP::cookie "wcw_auth"]: Retrieves the value of the "wcw_auth" cookie.
    log local0. "WCW Auth Cookie: $wcw_cookie": Logs the cookie value if it exists.
    log local0. "WCW Auth Cookie: Not Present": Logs a message if the cookie is not present.

    By adding these lines to your iRule, you can log the additional information you need.

    Kindly rate

    HTH

    F5 Design Engineer