Skip to content

Commit

Permalink
backported HP-UX related build and runtime fixes from syslog-ng PE
Browse files Browse the repository at this point in the history
2007-09-22  Balazs Scheidler <[email protected]>

	* configure.in: added HP-UX + gcc specific CFLAGS to get all symbols
	  we need (_HPUX_SOURCE), also added a warning on a buggy system
	  headers, fixed HP-UX link options

	* tgzbuild/*: added tgz binary packaging for ZBS

	* contrib/hpux-packaging/*: new files, default configuration files
	  for HP-UX

	* src/afunix.c (afunix_sd_init): fixed compilation warnings on
	  HP-UX, added explicit casts for uid_t, gid_t and mode_t

	* src/logreader.c (log_reader_iterate_buf): fix message processing
	  on padded pipes that is used by HP-UX

	* src/syslog-ng.h: added some macros for platforms that miss strtoll
  • Loading branch information
bazsi committed Sep 22, 2007
1 parent f4a72eb commit f705d56
Show file tree
Hide file tree
Showing 13 changed files with 476 additions and 32 deletions.
178 changes: 178 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

Installation instructions for SYSLOG-NG
=======================================

Welcome. This is syslog-ng, which stands for syslog-new-generation, a new,
enhanced system logging daemon.

Unpacking the distribution
==========================

The distribution arrives in .tar.gz format though OS/distribution packaging
is possible. The file is named:

syslog-ng-x.xx.tar.gz

where x.xx stands for the version number. You must have tar and gzip to
unpack the distribution (sorry, compress is not supported). If you have GNU
tar simply execute the following command:

tar xvfz syslog-ng-x.xx.tar.gz

If your version of tar doesn't support z (most non-GNU tars), you should
execute this one:

gunzip -c syslog-ng-x.xx.tar.gz | tar xvf -

After this, you'll get a directory named syslog-ng-x.xx, where the source for
syslog-ng will be unpacked.

Compiling the program:
======================

syslog-ng requires gcc as a C compiler (at least version 2.7.2), GNU flex as
a lex, and bison as a parser generator. Some GNU C and GNU flex extensions
are used, porting to other compilers/lex/yacc combination is welcome.

Syslog-ng relies on a number of third party libraries in order to be
compiled, these are:
* libnet if spoof-source support is enabled in configure
(--enable-spoof-source)
* libwrap (aka TCP wrappers) if their use is enabled in configure
(--enable-tcp-wrapper)
* Glib a generic I/O library used by a wide variety of applications
* EventLog a generic event logging library developed by BalaBit

Once these libraries are installed, you can start compiling syslog-ng:

cd to the syslog-ng-x.xx directory, and execute the following commands:

./configure
make

After the make cycle finishes, you'll get an executable in the src
directory:

syslog-ng - the main binary

Now do a "make install" and you are done.

Compile time options
====================
A couple of features must be enabled in compile time using one of the
--enable-<feature> option to the configure script.

Currently the following compile time features exist:

--enable-debug include debug info
--enable-sun-streams enable Sun STREAMS support even if not detected (autodetected by default)
--enable-sun-door enable Sun door support even if not detected (autodetected by default)
--enable-tcp-wrapper enable using /etc/hosts.deny & /etc/hosts.allow for TCP access (disabled by default)
--enable-spoof-source enable spoof_source feature (also requires libnet) (disabled by default)
--enable-ipv6 enable support for IPv6
--enable-static-linking compile syslog-ng as a static binary
--enable-dynamic-linking compile syslog-ng as a completely dynamic binary,
if not specified syslog-ng links dynamically to
system libraries and statically to everything else.

Platform specific compilation issues
====================================

HP-UX with gcc 4.x
------------------

The gcc available for HP-UX gives an error message in sys/socket.h, as a
function is defined as static and extern at the same time. Earlier gcc
versions and the HP compiler only gives a warning, gcc4 issues an error.

The solution is to copy sys/socket.h to your gcc-private include
directory and fix the offending declaration.

Configuration file:
===================

Syslog-ng uses a different configuration scheme than the original syslogd,
which sits at /etc/syslog-ng/syslog-ng.conf (or at a different location
depending the value passed to the --sysconfdir configure parameter).

The manpage for syslog-ng.conf(5) or the documentation under doc contains a
/reference about keywords and syntax which can be used in the
config file. For now I only explain system dependencies.

Every unix version has a slightly different way of sending log messages, and
since syslog-ng gives you the power of choosing your log-sources, you have to
be aware some of the internals.

Linux:
------
Linux has a dedicated unix socket called /dev/log, where log messages are
written to, and read from. It is of type SOCK_STREAM. So the correct source
statement for standard linux log messages is:

source stdlog { unix-stream("/dev/log"); };

Some newer Linux distributions (Debian GNU/Linux woody, and RedHat Linux
post 7.0) switched over to using SOCK_DGRAM in their sysklogd installation
by default. The libc autodetects which socket type is in use, but some
programs (like klogd) log directly to the log device bypassing libc. So if
you have logging problems you might want to switch log unix-dgram like
this:

source stdlog { unix-dgram("/dev/log"); };

BSDi:
-----
BSD is similar to Linux (or vice-versa Linux is similar to BSD, but this is
another issue), so BSD has also a unix socket for log communication, but
it's of type SOCK_DGRAM, and it is located at /var/run/log. So the source
statement you are looking for is:

source stdlog { unix-dgram("/var/run/log"); };

Solaris (2.5.1 or below):
-------------------------

SunOS/Solaris has a universal means of communications called STREAMS. It is
used as both an in-kernel and kernel-user interface. You'll need to feed the
following statement to syslog-ng to accept all messages:

source stdlog { sun-stream("/dev/log"); };

Solaris (2.6 - Solaris8)
-------------------

In addition to the STREAMS device used in earlier versions, a door is used to
make sure after each message that the system logging daemon is still running.
To create that door, you'll need the door() option of the sun-stream driver:
Sun has added a new method to the pool of possible IPC mechanisms, and it
is called door. syslog-ng supports this method with the sun-door keyword. A
door is a special file in the filesystem, and is called /etc/.syslog_door.
So your correct source statement would be:

source stdlog { sun-streams("/dev/log" door("/etc/.syslog_door")); };

Solaris 9
---------

The name of the door file has been changed from /etc/.syslog_door to
/var/run/syslog_door, the correct configuration needs to be:

source stdlog { sun-streams("/dev/log" door("/var/run/syslog_door")); };

AIX (unknown revision)
----------------------

AIX does support STREAMS, but its log transport doesn't use it. As it
seems /dev/log is a simple SOCK_DGRAM type unix socket, so it works using:

source stdlog { unix-dgram("/dev/log"); };

HP-UX (HP-UX 11.0)
------------------

HP-UX uses a named pipe called /dev/log for log transport, and you
can use this with the pipe() driver with an additional option. HP-UX pads
all incoming messages to 2048 bytes by default, so you need to specify
this:

source stdlog { pipe("/dev/log" pad_size(2048)); };
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = src tests doc contrib solbuild
SUBDIRS = src tests doc contrib solbuild tgzbuild

EXTRA_DIST = debian/README.Debian debian/copyright debian/syslog-ng.conf.example debian/syslog-ng.files debian/syslog-ng.logrotate debian/syslog-ng.postrm \
debian/changelog debian/changelog.in debian/rules debian/syslog-ng.default debian/syslog-ng.init debian/syslog-ng.logrotate.example debian/syslog-ng.preinst \
Expand Down
18 changes: 15 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ EVTLOG_MIN_VERSION="0.2"
dnl ***************************************************************************
dnl Initial setup

ostype=`uname -s`

if test -r $srcdir/dist.conf; then
# read defaults, dist.conf does not change
# values for parameters that are already set
Expand Down Expand Up @@ -71,6 +73,15 @@ AC_ARG_ENABLE(spoof-source,
[ --enable-spoof-source Enable support for spoofed source addresses.]
,,enable_spoof_source="auto")

case "$ostype" in
HP-UX)
if $CC -v 2>&1 | grep gcc > /dev/null; then
CFLAGS="$CFLAGS -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED -D_HPUX_SOURCE"
AC_MSG_WARN([NOTE: on HP-UX with gcc 4.x, you might need to edit sys/socket.h manually or you'll get compilation errors])
fi
;;
esac

dnl ***************************************************************************
dnl Checks for programs.

Expand All @@ -89,8 +100,8 @@ if echo $ldversion | egrep "GNU|Solaris" > /dev/null; then
LD_END_STATIC="-Wl,-Bdynamic"
AC_MSG_RESULT(GNU or Solaris)
elif test $ostype = "HP-UX" > /dev/null; then
LD_START_STATIC="-a archive"
LD_END_STATIC="-a shared_archive"
LD_START_STATIC="-Wl,-a,archive"
LD_END_STATIC="-Wl,-a,shared_archive"
AC_MSG_RESULT(HP-UX)
elif test "$ostype" = "AIX"; then
LD_START_STATIC="-Wl,-bstatic"
Expand Down Expand Up @@ -163,7 +174,7 @@ AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(regex, regexec)
AC_CHECK_LIB(resolv, res_init)

AC_CHECK_FUNCS(strdup strtol inet_aton inet_ntoa getopt_long getaddrinfo getutent)
AC_CHECK_FUNCS(strdup strtol strtoll strtoimax inet_aton inet_ntoa getopt_long getaddrinfo getutent)

old_LIBS=$LIBS
AC_CACHE_CHECK(for TCP wrapper library,
Expand Down Expand Up @@ -390,6 +401,7 @@ AC_OUTPUT(dist.conf
contrib/Makefile
tests/Makefile
solbuild/Makefile
tgzbuild/Makefile
tests/unit/Makefile
tests/functional/Makefile
)
6 changes: 3 additions & 3 deletions contrib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ EXTRA_DIST = README init.d.solaris init.d.HP-UX init.d.RedHat init.d.SuSE \
rhel-packaging/syslog-ng.conf \
rhel-packaging/syslog-ng.init \
rhel-packaging/syslog-ng.logrotate \
aix-packaging/syslog-ng.conf


aix-packaging/syslog-ng.conf \
hpux-packaging/syslog-ng.conf \
hpux-packaging/syslog-ng.init
86 changes: 86 additions & 0 deletions contrib/hpux-packaging/syslog-ng.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
# sample configuration file for syslog-ng on HP-UX
# users should customize to fit their needs
#

# log syslog-ng's own messages to /var/log/syslog-ng.log

source s_internal {
internal();
};

destination d_syslognglog {
file("/var/adm/syslog/syslog-ng.log" owner("root") group("adm") perm(0640));
};

log {
source(s_internal);
destination(d_syslognglog);
};

# log everything to /var/adm/syslog/messages

source s_local {
pipe("/dev/log" pad_size(2048));
};

destination d_messages {
file("/var/adm/syslog/messages" owner("root") group("adm") perm(0640));
};

log {
source(s_local);
destination(d_messages);
};

# Remote logging
#
#source s_remote {
# tcp(ip(0.0.0.0) port(514));
# udp(ip(0.0.0.0) port(514));
#};
#
#destination d_separatedbyhosts {
# file("/var/adm/syslog/syslog-ng/$HOST/messages" owner("root") group("root") perm(0640) dir_perm(0750) create_dirs(yes));
#};
#
#log {
# source(s_remote);
# destination(d_separatedbyhosts);
#};

#
# Local filters examples
#

#filter f_messages { level(info..emerg); };
#filter f_secure { facility(authpriv); };
#filter f_mail { facility(mail); };
#filter f_cron { facility(cron); };
#filter f_emerg { level(emerg); };
#filter f_spooler { level(crit..emerg) and facility(uucp, news); };
#filter f_local7 { facility(local7); };

#
# Local destination examples
#

#destination d_secure { file("/var/log/secure"); };
#destination d_maillog { file("/var/log/maillog"); };
#destination d_cron { file("/var/log/cron"); };
#destination d_console { usertty("root"); };
#destination d_spooler { file("/var/log/spooler"); };
#destination d_bootlog { file("/var/log/boot.log"); };

#
# Local log examples - order DOES matter !
#
#log { source(s_local); filter(f_emerg); destination(d_console); };
#log { source(s_local); filter(f_secure); destination(d_secure); flags(final); };
#log { source(s_local); filter(f_maillog); destination(d_maillog); flags(final); };
#log { source(s_local); filter(f_cron); destination(d_cron); flags(final); };
#log { source(s_local); filter(f_spooler); destination(d_spooler); };
#log { source(s_local); filter(f_local7); destination(d_bootlog); };
#log { source(s_local); filter(f_messages); destination(d_messages); };


Loading

0 comments on commit f705d56

Please sign in to comment.