Chat now with support
Chat with Support

syslog-ng Premium Edition 7.0.34 - Administration Guide

Preface Introduction to syslog-ng The concepts of syslog-ng Installing syslog-ng PE The syslog-ng PE quick-start guide The syslog-ng PE configuration file Collecting log messages — sources and source drivers
How sources work default-network-drivers: Receive and parse common syslog messages internal: Collecting internal messages file: Collecting messages from text files google-pubsub: collecting messages from the Google Pub/Sub messaging service wildcard-file: Collecting messages from multiple text files linux-audit: Collecting messages from Linux audit logs mssql, oracle, sql: collecting messages from an SQL database network: Collecting messages using the RFC3164 protocol (network() driver) office365: Fetching logs from Office 365 osquery: Collect and parse osquery result logs pipe: Collecting messages from named pipes program: Receiving messages from external applications python: writing server-style Python sources python-fetcher: writing fetcher-style Python sources snmptrap: Read Net-SNMP traps syslog: Collecting messages using the IETF syslog protocol (syslog() driver) system: Collecting the system-specific log messages of a platform systemd-journal: Collecting messages from the systemd-journal system log storage systemd-syslog: Collecting systemd messages using a socket tcp, tcp6,udp, udp6: Collecting messages from remote hosts using the BSD syslog protocol udp-balancer: Receiving UDP messages at very high rate unix-stream, unix-dgram: Collecting messages from UNIX domain sockets windowsevent: Collecting Windows event logs
Sending and storing log messages — destinations and destination drivers
elasticsearch2>: Sending messages directly to Elasticsearch version 2.0 or higher (DEPRECATED) elasticsearch-http: Sending messages to Elasticsearch HTTP Event Collector file: Storing messages in plain-text files google_bigquery(): Sending logs to a Google BigQuery table google_bigquery_managedaccount(): Sending logs to a Google BigQuery table authenticated by Google Cloud managed service account google_pubsub(): Sending logs to the Google Cloud Pub/Sub messaging service google_pubsub-managedaccount(): Sending logs to the Google Cloud Pub/Sub messaging service authenticated by Google Cloud managed service account hdfs: Storing messages on the Hadoop Distributed File System (HDFS) http: Posting messages over HTTP kafka(): Publishing messages to Apache Kafka (Java implementation) (DEPRECATED) kafka-c(): Publishing messages to Apache Kafka using the librdkafka client (C implementation) logstore: Storing messages in encrypted files mongodb: Storing messages in a MongoDB database network: Sending messages to a remote log server using the RFC3164 protocol (network() driver) pipe: Sending messages to named pipes program: Sending messages to external applications python: writing custom Python destinations sentinel(): Sending logs to the Microsoft Azure Sentinel cloud snmp: Sending SNMP traps smtp: Generating SMTP messages (email) from logs splunk-hec: Sending messages to Splunk HTTP Event Collector sql(): Storing messages in an SQL database stackdriver: Sending logs to the Google Stackdriver cloud syslog: Sending messages to a remote logserver using the IETF-syslog protocol syslog-ng(): Forward logs to another syslog-ng node tcp, tcp6, udp, udp6: Sending messages to a remote log server using the legacy BSD-syslog protocol (tcp(), udp() drivers) unix-stream, unix-dgram: Sending messages to UNIX domain sockets usertty: Sending messages to a user terminal — usertty() destination Client-side failover
Routing messages: log paths, flags, and filters Global options of syslog-ng PE TLS-encrypted message transfer Advanced Log Transport Protocol Reliability and minimizing the loss of log messages Manipulating messages parser: Parse and segment structured messages Processing message content with a pattern database Correlating log messages Enriching log messages with external data Monitoring statistics and metrics of syslog-ng Multithreading and scaling in syslog-ng PE Troubleshooting syslog-ng Best practices and examples The syslog-ng manual pages Glossary

Installing syslog-ng PE on RPM-based platforms (Red Hat, SUSE, AIX)

The following describes how to install syslog-ng PE on operating systems that use the Red Hat Package Manager (RPM). Installing syslog-ng PE automatically replaces the original syslog service. The following supported operating systems use RPM:

  • Red Hat Enterprise Linux

  • Red Hat Enterprise Server

  • SUSE Linux Enterprise Server

Caution:

If you already had syslog-ng Open Source Edition (OSE) installed on the host, and are upgrading to syslog-ng Premium Edition, make sure that the ${SYSLOGNG_OPTIONS} environmental variable does not contain a -p <path-to-pid-file> option. If it does, remove this option from the environmental variable, because it can prevent syslog-ng PE from stopping properly. Typically, the environmental variable is set in the files /etc/default/syslog-ng or /etc/sysconfig/syslog-ng, depending on the operating system you use.

To install syslog-ng PE on operating systems that use the RPM

  1. Login to the Support Portal and download the syslog-ng RPM package for your system.

    • If the host already uses syslog-ng PE for logging, execute the following command as root. Otherwise, skip this step.

      rpm -U syslog-ng-premium-edition-<version>-<OS>-<arch>.rpm

      The syslog-ng Premium Edition application and all its dependencies will be installed, and the configuration of the existing syslog-ng PE installation will be used.

      NOTE: If you are upgrading from syslog-ng version 2.1, note that the location of the configuration file has been moved to /opt/syslog-ng/etc/syslog-ng.conf

    • Execute the following command as root:

      rpm -i syslog-ng-premium-edition-<version>-<OS>-<arch>.rpm

      The syslog-ng PE application and all its dependencies will be installed.

  2. Caution:

    When performing an upgrade, the package manager might automatically execute the post-uninstall script of the upgraded package, stopping syslog-ng PE and starting syslogd. If this happens, stop syslogd and start syslog-ng PE by issuing the following commands:

    /etc/init.d/syslogd stop
    /etc/init.d/syslog-ng start

    This behavior has been detected on CentOS 4 systems, but may occur on other rpm-based platforms as well.

  3. Edit the syslog-ng PE configuration file as needed. If you want to run syslog-ng PE in server mode, copy the license file to the /opt/syslog-ng/etc/ directory.

    For information on configuring syslog-ng PE, see the The syslog-ng PE quick-start guide.

  4. (Optional step for SELinux-enabled systems): Complete Using syslog-ng PE on SELinux.

Using syslog-ng PE on SELinux

Version syslog-ng PE 5 F2 and later properly supports SELinux on Red Hat Enterprise Linux 6.5 and newer platforms. Version 5 F5 and later also supports SELinux on Red Hat Enterprise Linux 5, as well as on 6.0-6.4. The CentOS and Oracle Linux platforms corresponding to the supported RHEL versions are supported as well. To use syslog-ng PE on a SELinux-enabled host, complete the following steps:

NOTE: The following steps install SELinux policy module that enables syslog-ng PE to properly run with its default configuration and default installation path (/opt/syslog-ng) on a SELinux-enabled host. If you configure syslog-ng PE to perform an operation that is outside the permissions of this policy module (for example, to bind to a non-standard port, use a program destination or source, or to write logfiles in a non-standard directory), you have to modify and recompile the policy module. If you need help with that, access the Support Portal. For contact details, see About us.

Prerequisites
  • The following packages must be available on the host: policycoreutils,policycoreutils-devel, policycoreutils-python. If they are not already installed, issue the following command: yum install policycoreutils policycoreutils-devel policycoreutils-python

  • On RHEL 6.5, update the following packages at least to the indicated versions. These packages are available in the Red Hat repositories and are installed by default on RHEL 6.6. You can update them with the yum update selinux-policy command:

    • selinux-policy-3.7.19-231.el6.noarch > 3.7.19-260.el6.noarch

    • selinux-policy-targeted-3.7.19-231.el6.noarch > 3.7.19-260.el6.noarch

  • The syslog-ng PE application must be installed on the host. For details, see Installing syslog-ng PE.

Installing the SELinux Policy Module

The SELinux Policy Module is included in the syslog-ng PE RHEL package.

NOTE: Only the unmodified SELinux configuration is supported.

To install the SELinux Policy Module,

  1. Run the /opt/syslog-ng/share/doc/selinux/syslog_ng.sh script to compile and load the SELinux rules for syslog-ng PE.
  2. Restart syslog-ng PE using the following command.

    Caution:

    The SELinux policy works only if syslog-ng PE is started by the init daemon.

    • On RHEL6: service syslog-ng restart

    • On RHEL7: systemctl restart syslog-ng

    If you do not use the service or the systemctl to start syslog-ng PE, run the syslog_ng.sh script again after starting syslog-ng PE. This is required to correct the settings of the files related to syslog-ng PE (most notably /dev/log and the files under /opt/syslog-ng). The settings can become incorrect if the privileges of the process that started syslog-ng PE are different from the privileges of the service or the systemctl process.

  3. (Optional): The syslog-ng PE application can create coredumps, but this is disabled by default. You can enable coredumps with the setsebool -P daemons_dump_core 1 command.

    Note that his command enables every daemons on your system to create core dumps, not just syslog-ng PE. There is no way to enable per-application core dumps in SELinux.

Expected result

The syslog-ng PE application is installed and properly running under SELinux. If syslog-ng PE does not start, or displays permission errors, run the syslog_ng.sh script.

Installing syslog-ng PE on Debian-based platforms

The following describes how to install syslog-ng PE (syslog-ng PE) on operating systems that use the Debian Software Package (deb) format. The following supported operating systems use this format:

  • Ubuntu 16.04 LTS (Xenial Xerus)

  • Ubuntu 18.04 LTS (Bionic Beaver)

Caution:

If you already had syslog-ng Open Source Edition (OSE) installed on the host, and are upgrading to syslog-ng Premium Edition, make sure that the ${SYSLOGNG_OPTIONS} environmental variable does not contain a -p <path-to-pid-file> option. If it does, remove this option from the environmental variable, because it can prevent syslog-ng PE from stopping properly. Typically, the environmental variable is set in the files /etc/default/syslog-ng or /etc/sysconfig/syslog-ng, depending on the operating system you use.

To install syslog-ng PE on operating systems that use the Debian Software Package (deb) format

  1. Login to your syslog-ng PE account and download the syslog-ng PE DEB package for your system.

  2. Issue the following command as root:

    dpkg -i syslog-ng-premium-edition-<version>-<OS>-<arch>.deb

  3. Answer the configuration questions of syslog-ng PE. These are described in detail in Installing syslog-ng using the .run installer.

    For information on configuring syslog-ng PE, see the The syslog-ng PE quick-start guide.

Installing syslog-ng in Docker

The following describes how to install syslog-ng PE in a Docker container. The following operating systems are supported:

  • CentOS 7

  • RedHat EL 7.5

  • Ubuntu 18.04 LTS (Bionic Beaver)

To install syslog-ng PE in a Docker container

  1. Start Docker. Use the command appropriate for you platform:

    • docker run -d -p <network-ports-forwarded-to-docker> -v <directories-to-be-mounted> --name syslog-ng-in-docker centos:7

    • docker run -d -p <network-ports-forwarded-to-docker> -v <directories-to-be-mounted> --name syslog-ng-in-docker registry.access.redhat.com/rhel-7.5-s390x

    • docker run -d -p <network-ports-forwarded-to-docker> -v <directories-to-be-mounted> --name syslog-ng-in-docker ubuntu:18.04

    For example, to forward port 514 and mount the etc and var directories on RedHat, use the following command: docker run -d -p 514:514 -v /root/docker/etc/:/opt/syslog-ng/etc -v /root/docker/var:/opt/syslog-ng/var --name syslog-ng-in-docker registry.access.redhat.com/rhel-7.5-s390x

    Note the following points:

    • Forward all ports to Docker that you want to receive messages from in your syslog-ng PE configuration.

    • The previous example mounts the etc and var directories from outside the docker container. That way you can edit the syslog-ng PE configuration file outside the container, and the syslog-ng PE persist file will not be deleted if you delete and recreate the docker container.

    • Do not mount the same var directory for multiple docker containers.

    • Make sure that the syslog-ng PE running in the docker container has permissions to read the configuration file, and read and write permissions for the var directory.

    • If you want to read the logs of the host from /dev/log, mount it into the Docker container. Note that only a single syslog-ng PE instance can read /dev/log at the same time. Do not mount the same /dev/log for multiple syslog-ng PE instances.

  2. Download the syslog-ng PE .run installation package from [[[Undefined variable General.downloads-text]]].

  3. Install syslog-ng PE in the Docker container. (Since there is no service management (systemd) in the docker container, the registration and start of the syslog-ng PE service is disabled.)

    docker exec -it syslog-ng-in-docker /bin/bash

    syslog-ng-premium-edition-7.0.34-linux-glibc2.11-amd64.run -- --accept-eula --silent --no-register

  4. (Optional Step) If you want to use any features of syslog-ng PE that require external packages (for example, Java or Python-based destinations), install the required packages manually in the Docker container (for example, Java or Python).

  5. Start syslog-ng PE.

    docker exec -i syslog-ng-in-docker /opt/syslog-ng/sbin/syslog-ng <-optional-command-line-parameters-of-syslog-ng>

    For the list of available command-line parameters, see the syslog-ng.8 manual page.

Start, reload, stop syslog-ng PE in a Docker container

To start syslog-ng PE, issue the following command in the Docker container.

docker exec -i syslog-ng-in-docker /opt/syslog-ng/sbin/syslog-ng <-optional-command-line-parameters-of-syslog-ng>

To reload syslog-ng PE, issue the following command in the Docker container.

docker exec -i syslog-ng-in-docker /opt/syslog-ng/sbin/syslog-ng-ctl reload

To stop syslog-ng PE, issue the following command in the Docker container.

docker exec -i syslog-ng-in-docker /opt/syslog-ng/sbin/syslog-ng-ctl stop

Upgrading syslog-ng PE running in a Docker container

To upgrade a syslog-ng PE instance that is running in a Docker container

  1. Download the new syslog-ng PE .run installation package from [[[Undefined variable General.downloads-text]]].

  2. Upgrade syslog-ng PE in the Docker container.

    docker exec -it syslog-ng-in-docker /bin/bash

    syslog-ng-premium-edition-7.0.34-linux-glibc2.11-amd64.run -- --accept-eula --silent --no-register --upgrade

  3. Start syslog-ng PE.

    docker exec -i syslog-ng-in-docker /opt/syslog-ng/sbin/syslog-ng <-optional-command-line-parameters-of-syslog-ng>

    For the list of available command-line parameters, see the syslog-ng.8 manual page.

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating