]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Log all transactions including those with uncertain status or no sent response.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 1 Apr 2011 14:39:24 +0000 (08:39 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 1 Apr 2011 14:39:24 +0000 (08:39 -0600)
Excluding those transactions from access log hides valuable information.

For example, it hides certain aborted client transactions which sometimes
indicate Squid bugs or configuration problems that the administrator can fix.
It also leads to wrong statistics reporting if the reporting tools are based
on access logs information.

The change just removes the logging guard and adds debugging. The logging
code itself is unchanged except for indenting.

src/client_side.cc

index 94d61be179321e3c4f835d9469e0a592ea90a527..52cf389d8c42a7516ac703d0091527b0c1d8118f 100644 (file)
@@ -615,74 +615,75 @@ prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry * aLogEntry)
 void
 ClientHttpRequest::logRequest()
 {
-    if (out.size || logType) {
-        al.icp.opcode = ICP_INVALID;
-        al.url = log_uri;
-        debugs(33, 9, "clientLogRequest: al.url='" << al.url << "'");
-
-        if (al.reply) {
-            al.http.code = al.reply->sline.status;
-            al.http.content_type = al.reply->content_type.termedBuf();
-        } else if (loggingEntry() && loggingEntry()->mem_obj) {
-            al.http.code = loggingEntry()->mem_obj->getReply()->sline.status;
-            al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf();
-        }
+    if (!out.size && !logType)
+        debugs(33, 5, HERE << "logging half-baked transaction: " << log_uri);
+
+    al.icp.opcode = ICP_INVALID;
+    al.url = log_uri;
+    debugs(33, 9, "clientLogRequest: al.url='" << al.url << "'");
+
+    if (al.reply) {
+        al.http.code = al.reply->sline.status;
+        al.http.content_type = al.reply->content_type.termedBuf();
+    } else if (loggingEntry() && loggingEntry()->mem_obj) {
+        al.http.code = loggingEntry()->mem_obj->getReply()->sline.status;
+        al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf();
+    }
 
-        debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'");
+    debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'");
 
-        if (loggingEntry() && loggingEntry()->mem_obj)
-            al.cache.objectSize = loggingEntry()->contentLen();
+    if (loggingEntry() && loggingEntry()->mem_obj)
+        al.cache.objectSize = loggingEntry()->contentLen();
 
-        al.cache.caddr.SetNoAddr();
+    al.cache.caddr.SetNoAddr();
 
-        if (getConn() != NULL) al.cache.caddr = getConn()->log_addr;
+    if (getConn() != NULL) al.cache.caddr = getConn()->log_addr;
 
-        al.cache.requestSize = req_sz;
-        al.cache.requestHeadersSize = req_sz;
+    al.cache.requestSize = req_sz;
+    al.cache.requestHeadersSize = req_sz;
 
-        al.cache.replySize = out.size;
-        al.cache.replyHeadersSize = out.headers_sz;
+    al.cache.replySize = out.size;
+    al.cache.replyHeadersSize = out.headers_sz;
 
-        al.cache.highOffset = out.offset;
+    al.cache.highOffset = out.offset;
 
-        al.cache.code = logType;
+    al.cache.code = logType;
 
-        al.cache.msec = tvSubMsec(start_time, current_time);
+    al.cache.msec = tvSubMsec(start_time, current_time);
 
-        if (request)
-            prepareLogWithRequestDetails(request, &al);
+    if (request)
+        prepareLogWithRequestDetails(request, &al);
 
-        if (getConn() != NULL && getConn()->rfc931[0])
-            al.cache.rfc931 = getConn()->rfc931;
+    if (getConn() != NULL && getConn()->rfc931[0])
+        al.cache.rfc931 = getConn()->rfc931;
 
 #if USE_SSL && 0
 
-        /* This is broken. Fails if the connection has been closed. Needs
-         * to snarf the ssl details some place earlier..
-         */
-        if (getConn() != NULL)
-            al.cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl);
+    /* This is broken. Fails if the connection has been closed. Needs
+     * to snarf the ssl details some place earlier..
+     */
+    if (getConn() != NULL)
+        al.cache.ssluser = sslGetUserEmail(fd_table[getConn()->fd].ssl);
 
 #endif
 
-        ACLFilledChecklist *checklist = clientAclChecklistCreate(Config.accessList.log, this);
+    ACLFilledChecklist *checklist = clientAclChecklistCreate(Config.accessList.log, this);
 
-        if (al.reply)
-            checklist->reply = HTTPMSGLOCK(al.reply);
+    if (al.reply)
+        checklist->reply = HTTPMSGLOCK(al.reply);
 
-        if (!Config.accessList.log || checklist->fastCheck()) {
-            if (request)
-                al.adapted_request = HTTPMSGLOCK(request);
-            accessLogLog(&al, checklist);
-            updateCounters();
-
-            if (getConn() != NULL)
-                clientdbUpdate(getConn()->peer, logType, AnyP::PROTO_HTTP, out.size);
-        }
+    if (!Config.accessList.log || checklist->fastCheck()) {
+        if (request)
+            al.adapted_request = HTTPMSGLOCK(request);
+        accessLogLog(&al, checklist);
+        updateCounters();
 
-        delete checklist;
+        if (getConn() != NULL)
+            clientdbUpdate(getConn()->peer, logType, AnyP::PROTO_HTTP, out.size);
     }
 
+    delete checklist;
+
     accessLogFreeMemory(&al);
 }