Logging client connection errors/closed connections with apache

apache-2.2connection

Is there a way to log/record apache connections which are prematurely cut off by the client (either deliberately, or due to a connection error)?

Short story is this: I'm working on educational/training software, and users from one specific location are experiencing a number of errors where it appears that on some requests, they are only receiving part of the response.

This manifests in broken HTML, syntax errors in JavaScript files, and half-complete JSON responses.

Seeing as no other users report these errors, I'm convinced that there's a connection problem from that location, but I need to be able to show that connections were cut off prematurely by the client in order to do that.

So is there any way to record/log when the client prematurely ended the connection?

Best Answer

LogFormat's %X should write X to the log file when the connection has been aborted after processing was done. I haven't tested it but from the documentation (mod_log_config), this seems like what you're looking for. Keep in mind that this doesn't necessarily mean there's an issue on their side.

I can think of two other ways of troubleshooting this that would give you even more information:

  1. Get a tcpdump, preferably filtering by their IP origin, and analyze it using a tool like Wireshark. You can see what's going on on the TCP level and better understand their issues, but if you have high load, analyzing it can be painful.
  2. Getting an end user experience monitoring solution. I realize telling you to spend money on a tool to solve an issue you have right now is not what you're looking for, but these are generally good value for the money in your kind of situation.
Related Topic