On an auth failure the uid and the IP address should be logged to the standard log file.
  This update works for a standard setup, when using a proxy for the server one can probably use the X-forwarded-for header
  instead of the remote address.