The following describes how to install syslog-ng PE in a Docker container. The following operating systems are supported:
To install syslog-ng PE in a Docker container
-
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.
-
Download the syslog-ng PE .run installation package from Downloads page.
-
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.29-linux-glibc2.11-amd64.run -- --accept-eula --silent --no-register
-
(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).
-
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
-
Download the new syslog-ng PE .run installation package from Downloads page.
-
Upgrade syslog-ng PE in the Docker container.
docker exec -it syslog-ng-in-docker /bin/bash
syslog-ng-premium-edition-7.0.29-linux-glibc2.11-amd64.run -- --accept-eula --silent --no-register --upgrade
-
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.
|
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. |
This section describes how to install the syslog-ng PE application interactively using the binary installer. The installer has a simple interface: use the TAB or the arrow keys of your keyboard to navigate between the options, and Enter to select an option.
NOTE: The installer stops the running syslogd application if it is running, but its components are not removed. The /etc/init.d/sysklogd init script is automatically renamed to /etc/init.d/sysklogd.backup. Rename this file to its original name if you want to remove syslog-ng or restart the syslogd package.
The following describes how to install syslog-ng Premium Edition on clients or relays. For details on the different operation modes of syslog-ng PE, see Modes of operation.
To install syslog-ng Premium Edition on clients or relays
NOTE: The native logrotation tools do not send a SIGHUP to syslog-ng after rotating the log files, causing syslog-ng to write into files already rotated. To solve this problem, the syslog-ng init script links the /var/run/syslog.pid file to syslog-ng's pid. Also, on Linux, the install.sh script symlinks the initscript of the original syslog daemon to syslog-ng's initscript.
-
Login to the Support Portal and download the syslog-ng PE installer package.
-
Enable the executable attribute for the installer using the chmod +x syslog-ng-<edition>-<version>-<OS>-<platform>.run, then start the installer as root using the ./syslog-ng-<edition>-<version>-<OS>-<platform>.run command. (Note that the exact name of the file depends on the operating system and platform.) Wait until the package is uncompressed and the welcome screen appears, then select Continue.
Figure 5: The welcome screen
-
Accepting the EULA: You can install syslog-ng PE only if you understand and accept the terms of the End-User License Agreement (EULA). The full text of the EULA can be displayed during installation by selecting the Show EULA option, and is also available in this guide for convenience at Software Transaction, License and End User License Agreements. Select Accept to accept the EULA and continue the installation.
If you do not accept the terms of the EULA for some reason, select Reject to cancel installing syslog-ng PE.
-
Detecting platform and operating system: The installer attempts to automatically detect your oprating system and platform. If the displayed information is correct, select Yes. Otherwise select Exit to abort the installation, and verify that your platform is supported. For a list of supported platforms, see Supported platforms. If your platform is supported but not detected correctly, contact your local distributor, reseller, or access the Support Portal. For contact details, see About us.
Figure 6: Platform detection
-
Installation path: Enter the path to install syslog-ng PE to. This is useful if you intend to install syslog-ng PE without registering it as a service, or if it cannot be installed to the default location because of policy compliance reasons. If no path is given, syslog-ng PE is installed to the default folder.
Figure 7: Installation path
NOTE: When installing syslog-ng PE to an alternative path on AIX, HP-UX, or Solaris platforms, set the CHARSETALIASDIR environmental variable to the lib subdirectory of the installation path. That way syslog-ng PE can find the charset.alias file.
-
Registering as syslog service: Select Register to register syslog-ng PE as the syslog service. This will stop and disable the default syslog service of the system.
Figure 8: Registering as syslog service
-
Locating the license: Since you are installing syslog-ng PE in client or relay mode, simply select OK. For details on the different operation modes of syslog-ng PE, see Modes of operation.
-
Upgrading: The syslog-ng PE installer can automatically detect if you have previously installed a version of syslog-ng PE on your system. To use the configuration file of this previous installation, select Yes. To ignore the old configuration file and create a new one, select No.
Note that if you decide to use your existing configuration file, the installer automatically checks it for syntax error and displays a list of warnings and errors if it finds any problems.
Figure 9: Upgrading syslog-ng
-
Generating a new configuration file: The installer displays some questions to generate a new configuration file.
-
Remote sources: Select Yes to accept log messages from the network. TCP, UDP, and SYSLOG messages on every interface will be automatically accepted.
Figure 10: Accepting remote messages
-
Remote destinations: Enter the IP address or hostname of your log server or relay and select OK.
Figure 11: Forwarding messages to the log server
NOTE: Accepting remote messages and forwarding them to a log server means that syslog-ng PE will start in relay mode.
-
After the installation is finished, add the /opt/syslog-ng/bin and /opt/syslog-ng/sbin directories to your search PATH environment variable. That way you can use syslog-ng PE and its related tools without having to specify the full pathname. Add the following line to your shell profile:
PATH=/opt/syslog-ng/bin:$PATH
-
(Optional step for SELinux-enabled systems): Complete Using syslog-ng PE on SELinux.
The following describes how to install syslog-ng PE on log servers. For details on the different operation modes of syslog-ng PE, see Modes of operation.
To install syslog-ng PE on log servers
-
Login to the Support Portal and download the syslog-ng PE installer package and your syslog-ng Premium Edition license file (license.txt). The license will be required to run syslog-ng PE in server mode (see Server mode) and is needed when you are installing syslog-ng PE on your central log server.
-
Enable the executable attribute for the installer using the chmod +x syslog-ng-<edition>-<version>-<OS>-<platform>.run, then start the installer as root using the ./syslog-ng-<edition>-<version>-<OS>-<platform>.run command. (Note that the exact name of the file depends on the operating system and platform.) Wait until the package is uncompressed and the welcome screen appears, then select Continue.
Figure 12: The welcome screen
-
Accepting the EULA: You can install syslog-ng PE only if you understand and accept the terms of the End-User License Agreement (EULA). The full text of the EULA can be displayed during installation by selecting the Show EULA option, and is also available in this guide for convenience at Software Transaction, License and End User License Agreements. Select Accept to accept the EULA and continue the installation.
If you do not accept the terms of the EULA for some reason, select Reject to cancel installing syslog-ng PE.
-
Detecting platform and operating system: The installer attempts to automatically detect your oprating system and platform. If the displayed information is correct, select Yes. Otherwise select Exit to abort the installation, and verify that your platform is supported. For a list of supported platforms, see Supported platforms. If your platform is supported but not detected correctly, contact your local distributor, reseller, or access the Support Portal. For contact details, see About us.
Figure 13: Platform detection
-
Installation path: Enter the path to install syslog-ng PE to. This is useful if you intend to install syslog-ng PE without registering it as a service, or if it cannot be installed to the default location because of policy compliance reasons. If no path is given, syslog-ng PE is installed to the default folder.
Figure 14: Installation path
NOTE: When installing syslog-ng PE to an alternative path on AIX, HP-UX, or Solaris platforms, set the CHARSETALIASDIR environmental variable to the lib subdirectory of the installation path. That way syslog-ng PE can find the charset.alias file.
-
Registering as syslog service: Select Register to register syslog-ng PE as the syslog service. This will stop and disable the default syslog service of the system.
Figure 15: Registering as syslog service
-
Locating the license: Enter the path to your license file (license.txt) and select OK. Typically this is required only for your central log server.
If you are upgrading an existing configuration that already has a license file, the installer automatically detects it.
Figure 16: Platform detection
-
Upgrading: The syslog-ng PE installer can automatically detect if you have previously installed a version of syslog-ng PE on your system. To use the configuration file of this previous installation, select Yes. To ignore the old configuration file and create a new one, select No.
Note that if you decide to use your existing configuration file, the installer automatically checks it for syntax error and displays a list of warnings and errors if it finds any problems.
Figure 17: Upgrading syslog-ng
-
Generating a new configuration file: The installer displays some questions to generate a new configuration file.
-
Remote sources: Select Yes to accept log messages from the network. TCP, UDP, and SYSLOG messages on every interface will be automatically accepted.
Figure 18: Accepting remote messages
-
Remote destinations: Enter the IP address or hostname of your log server or relay and select OK.
Figure 19: Forwarding messages to the log server
NOTE: Accepting remote messages and forwarding them to a log server means that syslog-ng PE will start in relay mode.
-
After the installation is finished, add the /opt/syslog-ng/bin and /opt/syslog-ng/sbin directories to your search PATH environment variable. That way you can use syslog-ng PE and its related tools without having to specify the full pathname. Add the following line to your shell profile:
PATH=/opt/syslog-ng/bin:$PATH
NOTE: The native logrotation tools do not send a SIGHUP to syslog-ng after rotating the log files, causing syslog-ng to write into files already rotated. To solve this problem, the syslog-ng init script links the /var/run/syslog.pid file to syslog-ng's pid. Also, on Linux, the install.sh script symlinks the initscript of the original syslog daemon to syslog-ng's initscript.
-
(Optional step for SELinux-enabled systems): Complete Using syslog-ng PE on SELinux.