#
-# $Id: cf.data.pre,v 1.198 2000/10/04 03:18:58 wessels Exp $
+# $Id: cf.data.pre,v 1.199 2000/11/01 04:03:14 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
Set this to 'round-robin' as an alternative.
DOC_END
+NAME: forward_log
+IFDEF: WIP_FWD_LOG
+TYPE: string
+DEFAULT: none
+LOC: Config.Log.forward
+DOC_START
+ Logs the server-side requests.
+
+ This is currently work in progress.
+DOC_END
+
EOF
/*
- * $Id: forward.cc,v 1.74 2000/10/04 01:12:48 wessels Exp $
+ * $Id: forward.cc,v 1.75 2000/11/01 04:03:14 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
#define MAX_FWD_STATS_IDX 9
static int FwdReplyCodes[MAX_FWD_STATS_IDX + 1][HTTP_INVALID_HEADER + 1];
+#if WIP_FWD_LOG
+static void fwdLog(FwdState * fwdState);
+static Logfile *logfile = NULL;
+#endif
+
static void
fwdServerFree(FwdServer * fs)
{
assert(e->mem_obj);
#if URL_CHECKSUM_DEBUG
assert(e->mem_obj->chksum == url_checksum(e->mem_obj->url));
+#endif
+#if WIP_FWD_LOG
+ fwdLog(fwdState);
#endif
if (e->store_status == STORE_PENDING) {
if (e->mem_obj->inmem_hi == 0) {
cachemgrRegister("forward",
"Request Forwarding Statistics",
fwdStats, 0, 1);
+#if WIP_FWD_LOG
+ if (logfile)
+ (void) 0;
+ else if (NULL == Config.Log.forward)
+ (void) 0;
+ else
+ logfile = logfileOpen(Config.Log.forward, 0, 1);
+#endif
}
static void
}
/* NOTREACHED */
}
+
+#if WIP_FWD_LOG
+void
+fwdUninit(void)
+{
+ logfileClose(logfile);
+ logfile = NULL;
+}
+
+void
+fwdLogRotate(void)
+{
+ if (logfile)
+ logfileRotate(logfile);
+}
+
+static void
+fwdLog(FwdState * fwdState)
+{
+ if (NULL == logfile)
+ return;
+ logfilePrintf(logfile, "%9d.%03d %03d %s %s\n",
+ (int) current_time.tv_sec,
+ (int) current_time.tv_usec / 1000,
+ fwdState->last_status,
+ RequestMethodStr[fwdState->request->method],
+ fwdState->request->canonical);
+}
+
+void
+fwdStatus(FwdState * fwdState, http_status s)
+{
+ fwdState->last_status = s;
+}
+
+#endif
/*
- * $Id: http.cc,v 1.368 2000/10/31 23:48:13 wessels Exp $
+ * $Id: http.cc,v 1.369 2000/11/01 04:03:14 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
httpProcessReplyHeader(httpState, buf, len);
if (httpState->reply_hdr_state == 2) {
http_status s = entry->mem_obj->reply->sline.status;
+#if WIP_FWD_LOG
+ fwdStatus(httpState->fwd, s);
+#endif
/*
* If its not a reply that we will re-forward, then
* allow the client to get it.
/*
- * $Id: main.cc,v 1.320 2000/11/01 03:58:52 wessels Exp $
+ * $Id: main.cc,v 1.321 2000/11/01 04:03:14 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
accessLogRotate(); /* access.log */
useragentRotateLog(); /* useragent.log */
refererRotateLog(); /* referer.log */
+#if WIP_FWD_LOG
+ fwdLogRotate();
+#endif
icmpOpen();
#if USE_DNSSERVERS
dnsInit();
storeDirSync(); /* Flush log writes */
storeLogClose();
accessLogClose();
+#if WIP_FWD_LOG
+ fwdUninit();
+#endif
storeDirSync(); /* Flush log close */
#if PURIFY || XMALLOC_TRACE
storeFsDone();
/*
- * $Id: protos.h,v 1.385 2000/11/01 03:35:40 wessels Exp $
+ * $Id: protos.h,v 1.386 2000/11/01 04:03:15 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern void fwdInit(void);
extern int fwdReforwardableStatus(http_status s);
extern void fwdServersFree(FwdServer ** FS);
+#if WIP_FWD_LOG
+extern void fwdUninit(void);
+extern void fwdLogRotate(void);
+extern void fwdStatus(FwdState *, http_status);
+#endif
extern void urnStart(request_t *, StoreEntry *);
/*
- * $Id: structs.h,v 1.357 2000/10/31 23:48:15 wessels Exp $
+ * $Id: structs.h,v 1.358 2000/11/01 04:03:15 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
#endif
#if USE_REFERER_LOG
char *referer;
+#endif
+#if WIP_FWD_LOG
+ char *forward;
#endif
int rotateNumber;
} Log;
ErrorState *err;
time_t start;
int n_tries;
+#if WIP_FWD_LOG
+ http_status last_status;
+#endif
struct {
unsigned int dont_retry:1;
unsigned int ftp_pasv_failed:1;