The log_icap and log_access are not really needed to control requests logging.
Someone can use acls with access_log and icap_log configuration directives
for this purpose.
Also currently the requests denied for logging using the log_access access list
will not be accounted for in performance counters.
This patch:
- removes log_icap and log_access options from configuration file.
- adds the "stats_collection" access list to control performane counters
accounting.
This is a Measurement Factory project
acl_access *AlwaysDirect;
acl_access *ASlists;
acl_access *noCache;
- acl_access *log;
+ acl_access *stats_collection;
#if SQUID_SNMP
acl_access *snmp;
acl_access *followXFF;
#endif /* FOLLOW_X_FORWARDED_FOR */
-#if ICAP_CLIENT
- acl_access* icap;
-#endif
-
/// spoof_client_ip squid.conf acl.
/// nil unless configured
acl_access* spoof_client_ip;
*/
#include "squid.h"
-#include "acl/FilledChecklist.h"
#include "adaptation/icap/Config.h"
#include "adaptation/icap/Launcher.h"
#include "adaptation/icap/Xaction.h"
#include "err_detail_type.h"
#include "fde.h"
#include "FwdState.h"
-#include "globals.h"
#include "HttpMsg.h"
#include "HttpReply.h"
#include "HttpRequest.h"
void Adaptation::Icap::Xaction::maybeLog()
{
if (IcapLogfileStatus == LOG_ENABLE) {
- ACLFilledChecklist *checklist = new ACLFilledChecklist(::Config.accessList.icap, al.request, dash_str);
- if (al.reply) {
- checklist->reply = al.reply;
- HTTPMSGLOCK(checklist->reply);
- }
- if (!::Config.accessList.icap || checklist->fastCheck() == ACCESS_ALLOWED) {
- finalizeLogInfo();
- icapLogLog(alep, checklist);
- }
- delete checklist;
+ finalizeLogInfo();
+ icapLogLog(alep);
}
}
#include "squid.h"
#include "icap_log.h"
#include "AccessLogEntry.h"
+#include "acl/FilledChecklist.h"
+#include "HttpReply.h"
+#include "globals.h"
#include "log/CustomLog.h"
#include "log/File.h"
#include "log/Formats.h"
}
}
-void icapLogLog(AccessLogEntry::Pointer &al, ACLChecklist * checklist)
+void icapLogLog(AccessLogEntry::Pointer &al)
{
- if (IcapLogfileStatus == LOG_ENABLE)
- accessLogLogTo(Config.Log.icaplogs, al, checklist);
+ if (IcapLogfileStatus == LOG_ENABLE) {
+ ACLFilledChecklist checklist(NULL, al->adapted_request, NULL);
+ if (al->reply) {
+ checklist.reply = al->reply;
+ HTTPMSGLOCK(checklist.reply);
+ }
+ accessLogLogTo(Config.Log.icaplogs, al, &checklist);
+ }
}
void icapLogClose();
void icapLogOpen();
void icapLogRotate();
-void icapLogLog(AccessLogEntryPointer &al, ACLChecklist * checklist);
+void icapLogLog(AccessLogEntryPointer &al);
extern int IcapLogfileStatus;
debugs(3, DBG_CRITICAL, "WARNING: url_rewrite_concurrency upgrade overriding url_rewrite_children settings.");
Config.redirectChildren.concurrency = cval;
}
+
+ if (!strcmp(name, "log_access"))
+ self_destruct();
+
+ if (!strcmp(name, "log_icap"))
+ self_destruct();
}
/* Parse a time specification from the config file. Store the
DOC_END
NAME: log_access
+TYPE: obsolete
+DOC_START
+ Remove this line. Use acls with access_log directives to control access logging
+DOC_END
+
+NAME: log_icap
+TYPE: obsolete
+DOC_START
+ Remove this line. Use acls with icap_log directives to control icap logging
+DOC_END
+
+NAME: stats_collection
TYPE: acl_access
-LOC: Config.accessList.log
+LOC: Config.accessList.stats_collection
DEFAULT: none
DEFAULT_DOC: Allow logging for all transactions.
COMMENT: allow|deny acl acl...
DOC_START
- This options allows you to control which requests gets logged
- to access.log (see access_log directive). Requests denied for
- logging will also not be accounted for in performance counters.
+ This options allows you to control which requests gets accounted
+ in performance counters.
This clause only supports fast acl types.
See http://wiki.squid-cache.org/SquidFaq/SquidAcl for details.
DOC_END
-NAME: log_icap
-TYPE: acl_access
-IFDEF: ICAP_CLIENT
-LOC: Config.accessList.icap
-DEFAULT: none
-DEFAULT_DOC: Allow logging for all ICAP transactions.
-DOC_START
- This options allows you to control which requests get logged
- to icap.log. See the icap_log directive for ICAP log details.
-DOC_END
-
NAME: cache_store_log
TYPE: string
DEFAULT: none
}
}
- ACLFilledChecklist *checklist = clientAclChecklistCreate(Config.accessList.log, this);
-
+ ACLFilledChecklist checklist(NULL, request, NULL);
if (al->reply) {
- checklist->reply = al->reply;
- HTTPMSGLOCK(checklist->reply);
+ checklist.reply = al->reply;
+ HTTPMSGLOCK(checklist.reply);
+ }
+
+ if (request) {
+ al->adapted_request = request;
+ HTTPMSGLOCK(al->adapted_request);
}
+ accessLogLog(al, &checklist);
- if (!Config.accessList.log || checklist->fastCheck() == ACCESS_ALLOWED) {
- if (request) {
- al->adapted_request = request;
- HTTPMSGLOCK(al->adapted_request);
+ bool updatePerformanceCounters = true;
+ if (Config.accessList.stats_collection) {
+ ACLFilledChecklist statsCheck(Config.accessList.stats_collection, request, NULL);
+ if (al->reply) {
+ statsCheck.reply = al->reply;
+ HTTPMSGLOCK(statsCheck.reply);
}
- accessLogLog(al, checklist);
+ updatePerformanceCounters = (statsCheck.fastCheck() == ACCESS_ALLOWED);
+ }
+
+ if (updatePerformanceCounters) {
if (request)
updateCounters();
if (getConn() != NULL && getConn()->clientConnection != NULL)
clientdbUpdate(getConn()->clientConnection->remote, logType, AnyP::PROTO_HTTP, out.size);
}
-
- delete checklist;
}
void