]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Removed all references to hierarchy.log.
authorwessels <>
Sat, 27 Jul 1996 13:07:34 +0000 (13:07 +0000)
committerwessels <>
Sat, 27 Jul 1996 13:07:34 +0000 (13:07 +0000)
- Changed hierarchy_log_append() to hierarchyNote() and added
  _hierarchyLogData structure.

ChangeLog
src/Makefile.in
src/cache_cf.cc
src/main.cc
src/neighbors.cc
src/stat.cc
src/url.cc

index 982a3bbba2b3df6a4e773eb9fc5b27c6c6e44770..6a91588d45d8fe54e669b1174a0ebcaff726d1f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+       - Removed all references to hierarchy.log.
+       - Changed hierarchy_log_append() to hierarchyNote() and added
+         _hierarchyLogData structure.
+
 Changes to squid-1.1.alpha7:
 
        - Added 'tcp_recv_bufsize' option to config.
index 49119f3f6f844252cb5cec8ab4483978ecd7d876..4ac58f42ff39a2c465c69c3216e07816ccea93b9 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.31 1996/07/22 16:40:19 wessels Exp $
+#  $Id: Makefile.in,v 1.32 1996/07/27 07:07:41 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -25,7 +25,6 @@ DEFAULT_FTPGET          = $(libexecdir)/ftpget
 DEFAULT_DNSSERVER       = $(libexecdir)/dnsserver
 DEFAULT_CACHE_LOG       = $(localstatedir)/logs/cache.log
 DEFAULT_ACCESS_LOG      = $(localstatedir)/logs/access.log
-DEFAULT_HIERARCHY_LOG   = $(localstatedir)/logs/hierarchy.log
 DEFAULT_STORE_LOG       = $(localstatedir)/logs/store.log
 DEFAULT_SWAP_DIR        = $(localstatedir)/cache
 
@@ -70,7 +69,6 @@ DEFAULTS        = \
        -DDEFAULT_DNSSERVER=\"$(DEFAULT_DNSSERVER)\" \
        -DDEFAULT_CACHE_LOG=\"$(DEFAULT_CACHE_LOG)\" \
        -DDEFAULT_ACCESS_LOG=\"$(DEFAULT_ACCESS_LOG)\" \
-       -DDEFAULT_HIERARCHY_LOG=\"$(DEFAULT_HIERARCHY_LOG)\" \
        -DDEFAULT_STORE_LOG=\"$(DEFAULT_STORE_LOG)\" \
        -DDEFAULT_SWAP_DIR=\"$(DEFAULT_SWAP_DIR)\"
 
@@ -101,7 +99,6 @@ squid.conf: squid.conf.pre
        s%@DEFAULT_DNSSERVER@%$(DEFAULT_DNSSERVER)%g;\
        s%@DEFAULT_CACHE_LOG@%$(DEFAULT_CACHE_LOG)%g;\
        s%@DEFAULT_ACCESS_LOG@%$(DEFAULT_ACCESS_LOG)%g;\
-       s%@DEFAULT_HIERARCHY_LOG@%$(DEFAULT_HIERARCHY_LOG)%g;\
        s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\
        s%@DEFAULT_SWAP_DIR@%$(DEFAULT_SWAP_DIR)%g" <$? >$@
 
index c98be41b14b216728689790127d2d45c98c6e5a9..6bf1c88a0c3c0f107ad8a91b2d29467e72c6194b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.66 1996/07/26 19:28:49 wessels Exp $
+ * $Id: cache_cf.cc,v 1.67 1996/07/27 07:07:41 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -144,7 +144,6 @@ struct SquidConfig Config;
 
 #define DefaultCacheLogFile    DEFAULT_CACHE_LOG
 #define DefaultAccessLogFile   DEFAULT_ACCESS_LOG
-#define DefaultHierarchyLogFile DEFAULT_HIERARCHY_LOG
 #define DefaultStoreLogFile    DEFAULT_STORE_LOG
 #define DefaultLogRotateNumber  10
 #define DefaultAdminEmail      "webmaster"
@@ -684,16 +683,6 @@ static void parseAccessLogLine()
     Config.Log.access = xstrdup(token);
 }
 
-static void parseHierachyLogLine()
-{
-    char *token;
-    token = strtok(NULL, w_space);
-    if (token == NULL)
-       self_destruct();
-    safe_free(Config.Log.hierarchy);
-    Config.Log.hierarchy = xstrdup(token);
-}
-
 static void parseStoreLogLine()
 {
     char *token;
@@ -1048,9 +1037,6 @@ int parseConfigFile(file_name)
        else if (!strcmp(token, "cache_access_log"))
            parseAccessLogLine();
 
-       else if (!strcmp(token, "cache_hierarchy_log"))
-           parseHierachyLogLine();
-
        else if (!strcmp(token, "cache_store_log"))
            parseStoreLogLine();
 
@@ -1337,7 +1323,6 @@ static void configFreeMemory()
     safe_free(Config.Wais.relayHost);
     safe_free(Config.Log.log);
     safe_free(Config.Log.access);
-    safe_free(Config.Log.hierarchy);
     safe_free(Config.Log.store);
     safe_free(Config.adminEmail);
     safe_free(Config.effectiveUser);
@@ -1413,7 +1398,6 @@ static void configSetFactoryDefaults()
     Config.Port.icp = DefaultIcpPortNum;
     Config.Log.log = safe_xstrdup(DefaultCacheLogFile);
     Config.Log.access = safe_xstrdup(DefaultAccessLogFile);
-    Config.Log.hierarchy = safe_xstrdup(DefaultHierarchyLogFile);
     Config.Log.store = safe_xstrdup(DefaultStoreLogFile);
     Config.Log.rotateNumber = DefaultLogRotateNumber;
     Config.Program.ftpget = safe_xstrdup(DefaultFtpgetProgram);
index 6fbc82a59331e83019e43c76481b5393faf2b905..27983307614906c5deccacd30d05f4930bb272d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.56 1996/07/26 21:09:36 wessels Exp $
+ * $Id: main.cc,v 1.57 1996/07/27 07:07:43 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -545,7 +545,6 @@ int main(argc, argv)
            _db_rotate_log();   /* cache.log */
            storeWriteCleanLog();
            storeRotateLog();   /* store.log */
-           neighbors_rotate_log();     /* hierarchy.log */
            stat_rotate_log();  /* access.log */
            (void) ftpInitialize();
            rotate_pending = 0;
index fa45aa93fa1d5be85234fbc95e55349b092c75d2..47e2095e53e04cc201a1b7a1d70425cbdbb96ad6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.39 1996/07/26 21:09:37 wessels Exp $
+ * $Id: neighbors.cc,v 1.40 1996/07/27 07:07:43 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -114,8 +114,6 @@ static struct neighbor_cf *Neighbor_cf = NULL;
 static icp_common_t echo_hdr;
 static u_short echo_port;
 
-FILE *cache_hierarchy_log = NULL;
-
 char *hier_strings[] =
 {
     "NONE",
@@ -160,69 +158,17 @@ static edge *whichEdge(header, from)
     return (NULL);
 }
 
-
-void hierarchy_log_append(entry, code, timeout, cache_host)
-     StoreEntry *entry;
+void hierarchyNote(request, code, timeout, cache_host)
+     request_t *request;
      hier_code code;
      int timeout;
      char *cache_host;
 {
-    char *url = entry->url;
-    MemObject *mem = entry->mem_obj;
-    static time_t last_time = 0;
-    LOCAL_ARRAY(char, time_str, 128);
-    char *s = NULL;
-
-    if (!cache_hierarchy_log)
-       return;
-
-    if (code > HIER_MAX)
-       code = HIER_MAX;
-    if (mem)
-       mem->request->hierarchy_code = code;
-    if (mem && cache_host)
-       mem->request->hierarchy_host = xstrdup(cache_host);
-
-    if (Config.commonLogFormat) {
-       if (squid_curtime != last_time) {
-           s = mkhttpdlogtime(&squid_curtime);
-           strcpy(time_str, s);
-           last_time = squid_curtime;
-       }
-       if (cache_host) {
-           fprintf(cache_hierarchy_log, "[%s] %s %s%s %s\n",
-               time_str,
-               url,
-               timeout ? "TIMEOUT_" : "",
-               hier_strings[code],
-               cache_host);
-       } else {
-           fprintf(cache_hierarchy_log, "[%s] %s %s%s\n",
-               time_str,
-               url,
-               timeout ? "TIMEOUT_" : "",
-               hier_strings[code]);
-       }
-    } else {
-       if (cache_host) {
-           fprintf(cache_hierarchy_log, "%d.%03d %s %s%s %s\n",
-               (int) current_time.tv_sec,
-               (int) current_time.tv_usec / 1000,
-               url,
-               timeout ? "TIMEOUT_" : "",
-               hier_strings[code],
-               cache_host);
-       } else {
-           fprintf(cache_hierarchy_log, "%d.%03d %s %s%s\n",
-               (int) current_time.tv_sec,
-               (int) current_time.tv_usec / 1000,
-               url,
-               timeout ? "TIMEOUT_" : "",
-               hier_strings[code]);
-       }
+    if (request) {
+       request->hierarchy.code = code;
+       request->hierarchy.timeout = timeout;
+       request->hierarchy.host = xstrdup(cache_host);
     }
-    if (unbuffered_logs)
-       fflush(cache_hierarchy_log);
 }
 
 static int edgeWouldBePinged(e, request)
@@ -356,30 +302,6 @@ void neighborsDestroy()
     friends = NULL;
 }
 
-static void neighborsOpenLog(fname)
-     char *fname;
-{
-    int log_fd = -1;
-    /* Close and reopen the log.  It may have been renamed "manually"
-     * before HUP'ing us. */
-    if (cache_hierarchy_log) {
-       file_close(fileno(cache_hierarchy_log));
-       fclose(cache_hierarchy_log);
-       cache_hierarchy_log = NULL;
-    }
-    if (strcmp(fname, "none") != 0) {
-       log_fd = file_open(fname, NULL, O_WRONLY | O_CREAT);
-       if (log_fd < 0) {
-           debug(15, 0, "neighborsOpenLog: %s: %s\n", fname, xstrerror());
-       } else if ((cache_hierarchy_log = fdopen(log_fd, "a")) == NULL) {
-           file_close(log_fd);
-           debug(15, 0, "neighborsOpenLog: %s: %s\n", fname, xstrerror());
-       }
-    }
-    if (log_fd < 0 || cache_hierarchy_log == NULL)
-       debug(15, 1, "Hierachical logging is disabled.\n");
-}
-
 void neighbors_open(fd)
      int fd;
 {
@@ -667,7 +589,7 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz)
            /* if we reach here, source-ping reply is the first 'parent',
             * so fetch directly from the source */
            debug(15, 6, "Source is the first to respond.\n");
-           hierarchy_log_append(entry,
+           hierarchyNote(entry->mem_obj->request,
                HIER_SOURCE_FASTEST,
                0,
                fqdnFromAddr(from->sin_addr));
@@ -690,7 +612,7 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz)
            httpProcessReplyHeader(httpState, data, data_sz);
            storeAppend(entry, data, data_sz);
            storeComplete(entry);
-           hierarchy_log_append(entry,
+           hierarchyNote(entry->mem_obj->request,
                e->type == EDGE_PARENT ? HIER_PARENT_UDP_HIT_OBJ : HIER_SIBLING_UDP_HIT_OBJ,
                0,
                e->host);
@@ -703,7 +625,7 @@ void neighborsUdpAck(fd, url, header, from, entry, data, data_sz)
        if (e == NULL) {
            debug(15, 1, "neighborsUdpAck: Ignoring HIT from non-neighbor\n");
        } else {
-           hierarchy_log_append(entry,
+           hierarchyNote(entry->mem_obj->request,
                e->type == EDGE_SIBLING ? HIER_SIBLING_HIT : HIER_PARENT_HIT,
                0,
                e->host);
@@ -869,16 +791,12 @@ void neighbors_init()
     struct neighbor_cf *next = NULL;
     char *me = getMyHostname();
     edge *e = NULL;
-    char *fname = NULL;
 
     debug(15, 1, "neighbors_init: Initializing Neighbors...\n");
 
     if (friends == NULL)
        friends = xcalloc(1, sizeof(neighbors));
 
-    if ((fname = Config.Log.hierarchy))
-       neighborsOpenLog(fname);
-
     for (t = Neighbor_cf; t; t = next) {
        next = t->next;
        if (!strcmp(t->host, me) && t->http_port == Config.Port.http) {
@@ -921,33 +839,6 @@ void neighbors_init()
     any_addr.s_addr = inet_addr("0.0.0.0");
 }
 
-void neighbors_rotate_log()
-{
-    char *fname = NULL;
-    int i;
-    LOCAL_ARRAY(char, from, MAXPATHLEN);
-    LOCAL_ARRAY(char, to, MAXPATHLEN);
-
-    if ((fname = Config.Log.hierarchy) == NULL)
-       return;
-
-    debug(15, 1, "neighbors_rotate_log: Rotating.\n");
-
-    /* Rotate numbers 0 through N up one */
-    for (i = Config.Log.rotateNumber; i > 1;) {
-       i--;
-       sprintf(from, "%s.%d", fname, i - 1);
-       sprintf(to, "%s.%d", fname, i);
-       rename(from, to);
-    }
-    /* Rotate the current log to .0 */
-    if (Config.Log.rotateNumber > 0) {
-       sprintf(to, "%s.%d", fname, 0);
-       rename(fname, to);
-    }
-    neighborsOpenLog(fname);
-}
-
 edge *neighborFindByName(name)
      char *name;
 {
index 24dc7c6d5d217fa69655a545e666003bec598812..92aadc58ba6c711d8537d948766df8a34f44cd4c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stat.cc,v 1.50 1996/07/26 17:18:26 wessels Exp $
+ * $Id: stat.cc,v 1.51 1996/07/27 07:07:46 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -868,7 +868,7 @@ void parameter_get(obj, sentry)
 }
 
 
-void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, hier, neighbor)
+void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, hierData)
      cacheinfo *obj;
      char *url;
      struct in_addr caddr;
@@ -878,13 +878,15 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
      int http_code;
      int msec;
      char *ident;
-     hier_code hier;
-     char *neighbor;
+     struct _hierarchyLogData *hierData;
 {
     LOCAL_ARRAY(char, tmp, 6000);      /* MAX_URL is 4096 */
     int x;
     static char *dash = "-";
     char *client = NULL;
+    hier_code hier_code = HIER_NONE;
+    char *hier_host = dash;
+    int hier_timeout = 0;
 
     if (Config.Log.log_fqdn)
        client = fqdncache_gethostbyaddr(caddr, 0);
@@ -899,8 +901,11 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
        url = dash;
     if (!ident || ident[0] == '\0')
        ident = dash;
-    if (!neighbor)
-       neighbor = dash;
+    if (hierData) {
+       hier_code = hierData->code;
+       hier_host = hierData->host;
+       hier_timeout = hierData->timeout;
+    }
 
     if (obj->logfile_status == LOG_ENABLE) {
        if (Config.commonLogFormat)
@@ -913,7 +918,7 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
                action,
                size);
        else
-           sprintf(tmp, "%9d.%03d %6d %s %s/%03d %d %s %s %s %s/%s\n",
+           sprintf(tmp, "%9d.%03d %6d %s %s/%03d %d %s %s %s %s%s/%s\n",
                (int) current_time.tv_sec,
                (int) current_time.tv_usec / 1000,
                msec,
@@ -924,8 +929,9 @@ void log_append(obj, url, caddr, size, action, method, http_code, msec, ident, h
                method,
                url,
                ident,
-               hier_strings[hier],
-               neighbor);
+               hier_timeout ? "TIMEOUT_" : "",
+               hier_strings[hier_code],
+               hier_host);
        x = file_write(obj->logfile_fd,
            xstrdup(tmp),
            strlen(tmp),
index 283e132fa6cf6795722bfcf9c77a21657d9f01f2..eae39a0eed17656662989c035b16879908361530 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.26 1996/07/26 16:58:33 wessels Exp $
+ * $Id: url.cc,v 1.27 1996/07/27 07:07:47 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -280,7 +280,7 @@ void requestUnlink(request)
     request->link_count--;
     if (request->link_count) 
        return;
-    safe_free(request->hierarchy_host);
+    safe_free(request->hierarchy.host);
     put_free_request_t(request);
 }