[netflow-tools] Patch for socket-only logging

Jesse Kempf kempfj2 at cs.rpi.edu
Wed Oct 10 02:43:09 EST 2007


I've inlined the diff at the bottom of this email.

This fixes two issues:
1: When no log file is open, no flows should be put in the disk output
queue.
2: (logsock_num_errors % 10) == 0 will be true when there are no
errors, causing spurious warnings to be generated.

Cheers,
-Jesse Kempf

Index: utils/flowd-dsock-oqueue/flowd.c
===================================================================
--- utils/flowd-dsock-oqueue/flowd.c (revision 62)
+++ utils/flowd-dsock-oqueue/flowd.c (revision 112)
@@ -355,5 +355,5 @@
 		logerrx("%s: exiting on %s", __func__, ebuf);
 
-	if (output_flow_enqueue(fbuf, flen,
+	if (log_fd != -1 && output_flow_enqueue(fbuf, flen,
 	    conf->opts & FLOWD_OPT_VERBOSE) == -1) {
 		output_flow_flush(log_fd, conf->opts &
FLOWD_OPT_VERBOSE); @@ -366,5 +366,5 @@
 	/* Track failures to send on log socket so we can reopen it */
 	if (log_socket != -1 && send(log_socket, fbuf, flen, 0) == -1)
{
-		if ((logsock_num_errors % 10) == 0) {
+		if ((logsock_num_errors > 0) && (logsock_num_errors %
10) == 0) { logit(LOG_WARNING, "log socket send: %s "
 			    "(num errors %d)", strerror(errno),


More information about the netflow-tools mailing list