Forum Discussion
Peter__Draper_7
Nimbostratus
Jan 27, 2005Logging requested URI on a 404 redirect rule
I am starting to use iRules on 9.0.3 and am redirecting to a static IP of a virtual server when a 404 is received. I am logging the fact that a 404 has ben seen but would like to add in the requested...
unRuleY_95363
Feb 09, 2005Historic F5 Account
I might suggest you try removing the debug cruft and just try this:
when HTTP_REQUEST {
set log_uri [HTTP::uri]
}
when HTTP_RESPONSE {
if { [HTTP::status] eq "404" } {
HTTP::redirect "http:://10.10.10.1"
log "404 error $log_uri - redirected to 10.10.8.106"
}
}
You do not need to supply the local0. in v9 (this was fixed). The default facility.level is local0.info (you can still specify it if you want to though). If you continue to have trouble then I would suggest you try bracketing the variable with {}, as in ${log_uri}. This is how you deal with embedding a variable in the middle of another word.
For example:
"mybigfatgreek$log_uriwedding" will not work, it will print that string literally. However, if you say "mybigfatgreek${log_uri}wedding" it will work just fine.
Hope any of this helps you debug through your problem.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects