6.47. Rsyslog-4.2.0

The rsyslog package contains programs for logging system messages, such as those given by the kernel when unusual things happen.

6.47.1. Environment Settings

This package requires compiler variables to be set for the target in the environment.

export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"

6.47.2. Installation of Rsyslog

When Cross Compiling the configure script does not does not determine the correct values for the following, Set the values manually:

cat > config.cache << EOF
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
EOF

Prepare Rsyslog for compilation:

./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --prefix=/usr --sbindir=/sbin \
    --cache-file=config.cache

Compile the package:

make

This package does not come with a test suite.

Install the package:

make DESTDIR=${CLFS} install

Create a directory for expansion snippets:

install -dv ${CLFS}/etc/rsyslog.d

6.47.3. Configuring rsyslog

Create a new /etc/rsyslog.conf file by running the following:

cat > ${CLFS}/etc/rsyslog.conf << "EOF"
# Begin /etc/rsyslog.conf

# CLFS configuration of rsyslog. For more info use man rsyslog.conf

#######################################################################
# Rsyslog Modules

# Support for Local System Logging
$ModLoad imuxsock.so

# Support for Kernel Logging
$ModLoad imklog.so

#######################################################################
# Global Options

# Use traditional timestamp format.
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Set the default permissions for all log files.
$FileOwner root
$FileGroup root
$FileCreateMode 0640
$DirCreateMode 0755

# Provides UDP reception
$ModLoad imudp
$UDPServerRun 514

# Disable Repating of Entries
$RepeatedMsgReduction on

#######################################################################
# Include Rsyslog Config Snippets

$IncludeConfig /etc/rsyslog.d/*.conf

#######################################################################
# Standard Log Files

auth,authpriv.*                        /var/log/auth.log
*.*;auth,authpriv.none                -/var/log/syslog
daemon.*                        -/var/log/daemon.log
kern.*                                -/var/log/kern.log
lpr.*                                -/var/log/lpr.log
mail.*                                -/var/log/mail.log
user.*                                -/var/log/user.log

# Catch All Logs
*.=debug;\
        auth,authpriv.none;\
        news.none;mail.none        -/var/log/debug
*.=info;*.=notice;*.=warn;\
        auth,authpriv.none;\
        cron,daemon.none;\
        mail,news.none                -/var/log/messages

# Emergency are shown to everyone
*.emerg                                *

# End /etc/rsyslog.conf
EOF

6.47.4. Contents of rsyslog

Installed programs: rsyslogd

Short Descriptions

rsyslogd

Logs the messages that system programs offer for logging. Every logged message contains at least a date stamp and a hostname, and normally the program's name too, but that depends on how trusting the logging daemon is told to be.