[syslog-ng]Syslog-ng-1.5.24 build instructions for cygwin

John P. Rouillard rouilj@cs.umb.edu
Sun, 12 Jan 2003 23:15:54 -0500


Hi all:

Thanks go to whoever fixed the bug in cygwin1.dll that caused syslog
to fail as soon as a udp packet was sent to it. The bug was introduced
sometime around 1.3.12, but is fixed now. So here is my recipe for
building syslog-ng-1.5.24.

Download syslog-ng-1.5.24 and libol-0.3.6. Patch the syslog source
with the patch at the end of this message. The patch adds a -N flag to
stop the syslog server from forking so that windows services mechanism
and cygrunsrv will properly detect that the program/service is
running. The man page is updated with this flag, but the html/sgml
isn't patched.  The patch also stops resolv.h from being included
under __CYGWIN__, and defined the typdef uint32_t as unsigned.

After applying the patch, touch src/main.c.x src/filter.c.x, then
configure and make the two packages. Then run cygrunsrv as:

   cygrunsrv -I syslog -a '-N' -p /path/to/syslog -c /var/log
and
   cygrunsrv -S syslog

I use the syslog server with backlog to send the event log on my
windows 2000 SP3 system to a file. I did most of my testing without
tcp wrappers enabled, but I did finally get it to compile with the
wrappers. To do this, change the lines that read:

  old_LDFLAGS=$LDFLAGS
  LDFLAGS=-lwrap

to read

  old_LIBS=$LIBS
  LIBS=-lwrap

and you will get

  checking for hosts_access in -lwrap... yes

rather than

  checking for hosts_access in -lwrap... no

Hopefully the syslog-ng people will include this patch in newer
versions.

				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.

diff -ur syslog-ng-1.5.24/doc/syslog-ng.8 syslog-ng-1.5.24.l/doc/syslog-ng.8
--- syslog-ng-1.5.24/doc/syslog-ng.8	1999-07-10 11:58:32.000000000 -0400
+++ syslog-ng-1.5.24.l/doc/syslog-ng.8	2003-01-12 11:30:30.000000000 -0500
@@ -7,7 +7,7 @@
 
 .B syslog-ng
 [
-.B \-dvV
+.B \-NdvV
 ] [
 .B \-f
 <\fIconfig-filename\fP>
@@ -76,6 +76,15 @@
 .B \-p \0<filename>
 Write the current PID information to the specified file.
 .TP
+.B \-N
+Non-daemon mode. Adding \fB-N\fp to the command line will make syslog
+run in the foreground. This is used when starting syslog from service
+monitor programs in windows platforms using cygwin's cygrunsrv, but
+may also be useful for a startup/monitor wrapper that will restart
+syslog if it dies for some unusual reason. This does not cause any
+additional messages to be printed, so it will not fill up
+log files as \fB-d\fP or \fB-v\fP can.
+.TP
 .B \-v
 Enable verbose mode.  Process will not become a daemon.  Prints out
 fewer messages, compared to \fB-d\fP.
diff -ur syslog-ng-1.5.24/src/filters.c syslog-ng-1.5.24.l/src/filters.c
--- syslog-ng-1.5.24/src/filters.c	2002-02-04 11:07:50.000000000 -0500
+++ syslog-ng-1.5.24.l/src/filters.c	2003-01-12 11:21:57.000000000 -0500
@@ -259,6 +259,9 @@
                              struct log_filter *rule UNUSED,
                              struct log_info *log)
 {
+#if defined(__CYGWIN__)
+  typedef unsigned uint32_t;
+#endif
 	CAST(filter_expr_netmask, self, c);
        
 	if (log->saddr) {
diff -ur syslog-ng-1.5.24/src/main.c syslog-ng-1.5.24.l/src/main.c
--- syslog-ng-1.5.24/src/main.c	2002-10-30 14:36:03.000000000 -0500
+++ syslog-ng-1.5.24.l/src/main.c	2003-01-12 11:31:31.000000000 -0500
@@ -46,7 +46,9 @@
 #include <arpa/nameser.h>
 #endif
 
-#include <resolv.h>
+#if ! defined(__CYGWIN__)
+   #include <resolv.h>
+#endif
 
 #include "main.c.x"
 
@@ -425,7 +427,7 @@
 	gc_idle_threshold = 100;
 	gc_busy_threshold = 3000;
 
-	while ((opt = getopt_long(argc, argv, "sFf:p:dvhyVC:u:g:", syslog_ng_options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "sFf:p:dvhyVC:u:g:N", syslog_ng_options, NULL)) != -1) {
 		switch (opt) {
 		case 'f':
 			strncpy(cfgfilename, optarg, sizeof(cfgfilename));
@@ -464,6 +466,9 @@
 			yydebug = 1;
 			break;
 #endif
+		case 'N':
+		        do_fork = 0;
+		        break;
 		case 'h':
 		default:
 			usage();