Forum Discussion
Connections log
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
HTHF5 Design Engineer
Did this work for you Schin122 ? then please flag as answered.
For the next time it might be useful to start with looking at what is possible from the HTTP_REQUEST event https://clouddocs.f5.com/api/irules/HTTP_REQUEST.html
To me it is always useful to learn be trying and doing.
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