Forum Discussion
please help me to log http 500 responses
Hi all
I have a requirement to log http 500 errors from 2 web servers behind a virtual server ip. I need to log the client ip that requested and also the server that give the http 500 error, I have the below but its throwing up errors in the logs, can anyone help cheers
when HTTP_REQUEST { set hostvar [HTTP::host] set urivar [HTTP::uri] set ipvar [IP::client_addr] }
when HTTP_RESPONSE { if { [HTTP::status] eq 500 } { log local0. “$ipvar requested $hostvar $urivar and received a 500 from [IP::server_addr]” }}
The error logs are
Wed May 6 05:44:58 BST 2015 info F5-LOAD-BAL-1 tmm3[12660] Rule /Common/http-response-500-error-logging : &8220
Wed May 6 05:44:58 BST 2015 err F5-LOAD-BAL-1 tmm3[12660] 01220001 TCL error: /Common/http-response-500-error-logging - invalid command name "125.45.44.6" while executing "$ipvar requested $hostvar $urivar and received a 500 from [IP::server_addr]&8221"
3 Replies
- nitass
Employee
can you double check the irule again? the one you posted looks correct.
when HTTP_REQUEST { set hostvar [HTTP::host] set urivar [HTTP::uri] set ipvar [IP::client_addr] } when HTTP_RESPONSE { if { [HTTP::status] eq 500 } { log local0. "$ipvar requested $hostvar $urivar and received a 500 from [IP::server_addr]" } } - carl_townshend_
Nimbostratus
This is copied and pasted from my F5
when HTTP_REQUEST {
set hostvar [HTTP::host]
set urivar [HTTP::uri]
set ipvar [IP::client_addr] }
when HTTP_RESPONSE {
if { [HTTP::status] eq 500 } {
log local0. “$ipvar requested $hostvar $urivar and received a 500 from [IP::remote_addr]” }}
I am not seeing the node IP etc, and also what is the invalid command name that it keeps coming up with ?
cheers
- Max_Q_factor
Cirrocumulus
It could be the quotes coming up as an upside down quotes when I copy and paste from certain editors (like e-mail and MS word) the quotes sometimes get changed to fancy quotes to open and close a quote.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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