[syslog-ng]DNS caching

Balazs Scheidler bazsi@balabit.hu
Tue, 19 Mar 2002 10:24:55 +0100


On Tue, Mar 19, 2002 at 12:04:34PM +1000, Matthew Melvin wrote:
> Hello,
> 
> 	I'm loath to ask a question right off the blocks but I wasn't able 
> to find too much in the archives about this... 
> 
> I'm using syslog-ng 1.5.14 and am trying to get the 'dns_cache(yes);' option
> to work for me. When compiled with -DNSCACHE_DEBUG I get this message to
> start with...
> 
> initialising nscache: 1007 entries, 3600/60 expiration.
> 
> ... but no messages to suggest nscache_lookup() or any of the other cache
> functions are ever being called.  Is there more to this option than meets 
> the eye?  
> 
> Other recent discussions have talked about using djb's dnscache or nscd to
> do this instead and questioned the wisdom of using caching internal to
> syslog-ng.  Should I not be using this feature?  Does it, in fact, work at
> all?

can you check this patch, whether it fixes your problem ?

diff -u -r1.37 cfgfile.c
--- cfgfile.c	2001/09/03 16:42:23	1.37
+++ cfgfile.c	2002/03/19 09:23:55
@@ -212,7 +212,14 @@
 	gc_idle_threshold = self->gc_idle_threshold;
 	gc_busy_threshold = self->gc_busy_threshold;
 	center = make_log_center(self->connections);
-	
+
+	if (self->dns_cache)
+		self->cache = nscache_new(self->dns_cache_size,
+			                   self->dns_cache_expire,
+			                   self->dns_cache_expire_failed);
+	else
+		self->cache = NULL;
+
 	for (s = self->sources; s; s = s->next_source_group) {
 		res = LOG_HANDLER_INIT(s, self, p);
 		append_log_handler(s, center);
@@ -244,13 +251,6 @@
 			RESOLVE_VAR(d, self->destinations, next_dest_group, i);
 		}
 	}
-
-	if (self->dns_cache)
-		self->cache = nscache_new(self->dns_cache_size,
-			                   self->dns_cache_expire,
-			                   self->dns_cache_expire_failed);
-	else
-		self->cache = NULL;
 
 	return 1;
 }


-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1