8.94. Sysklogd-2.7.1

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

Approximate build time: less than 0.1 SBU
Required disk space: 4.1 MB

8.94.1. Installation of Sysklogd

Create the PKGBUILD for the Sysklogd package with the following commands:

mkdir /sources/sysklogd
cd /sources/sysklogd
cat > PKGBUILD << "REALEOF"
# Maintainer: Linux From Scratch <lfs-dev@lists.linuxfromscratch.org>

pkgname="sysklogd"
pkgver="2.7.1"
pkgrel="1"
pkgdesc="The sysklogd package contains programs for logging system messages."
arch=('x86'
      'x86_64')
url="https://www.infodrom.org/projects/sysklogd/"
license=('GPLv2')
groups=('core')
depends=('glibc'
         'rootfs')
makedepends=('binutils'
             'coreutils'
             'gcc'
             'make'
             'patch')
backup=('etc/syslog.conf')
source=('https://github.com/troglobit/sysklogd/releases/download/v2.7.1/sysklogd-2.7.1.tar.gz')
md5sums=('f4a1554f73a267218e69e168a8cb2950')

build(){
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr      \
              --sysconfdir=/etc  \
              --runstatedir=/run \
              --without-logger   \
              --disable-static   \
              --docdir="/usr/share/doc/${pkgname}-${pkgver}"
  make
}

package(){
  cd "${pkgname}-${pkgver}"
  make prefix="${pkgdir}" install

  # Install the default syslog.conf - this will be replaced after the build
  install -vdm755 "${pkgdir}/etc"
  cat > "${pkgdir}/etc/syslog.conf" << "EOF"
# Begin /etc/syslog.conf

auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *

# Do not open any internet ports.
secure_mode 2

# End /etc/syslog.conf
EOF
}
REALEOF

Prepare the build directory for the pacman user and build the package:

chown -R root:pacman .
chmod 2775 .
chmod 664 PKGBUILD
su pacman -c 'makepkg -L --nodeps'

Add the newly created package to the central package repository:

cp sysklogd-2.7.1-1-$(uname -m).pkg.tar.xz \
   /srv/pacman/repos/LFS/
repo-add /srv/pacman/repos/LFS/LFS.db.tar.xz \
         /srv/pacman/repos/LFS/sysklogd-2.7.1-1-$(uname -m).pkg.tar.xz

Update the local cache and install the Sysklogd package:

pacman -Syu
pacman -S sysklogd --overwrite \* -dd --noconfirm

Finally, copy the source files into the source repository and clean up the build directory:

mkdir /srv/pacman/source/LFS/sysklogd
cp PKGBUILD /srv/pacman/source/LFS/sysklogd
cd /sources
rm -rf sysklogd

8.94.2. Configuring Sysklogd

The /etc/syslog.conf file is the configureation file for sysklogd:

# Begin /etc/syslog.conf

auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *

# Do not open any internet ports.
secure_mode 2

# End /etc/syslog.conf

8.94.3. Contents of Sysklogd

Installed program: syslogd

Short Descriptions

syslogd

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.]