What to collect for HTTP - 500 Errors?

I’d like to log HTTP 500 errors but am unsure of what info to log. I know I can log IP::server_addr but what can I do as far as the URI a user was trying to hit that caused the error?

when HTTP_RESPONSE {
  if { [HTTP::status] contains "500"} {
log local0. "HTTP 500 from Server [IP::server_addr] for .... } }

Just curious about what info the server is sending when it sends a 500 so I know what’s loggable.

You would need to capture the uri on the inbound and save it in a variable. Here are a couple good rules in the codeshare that give you a start on what you might consider collecting:

http://devcentral.f5.com/wiki/default.aspx/iRules/FormattedLoggingForW3c.html Click Here

http://devcentral.f5.com/wiki/default.aspx/iRules/Custom\_Apache\_style\_logging\_for\_Java\_based\_applications.html Click Here

Regarding what info the server is sending, I’d say it depends. For example, Apache may send a generic 500 Internal Server Error status page, while a Java container may send a full stack trace (which may or may not be useful to you). There are a lot of different ways it can pan out, so your idea is a good one Chris: pull out what data you care about and log that.

-Matt