NXLog Docs

Docker

This topic describes the steps to install and upgrade NXLog on a Docker image.

Installing

First, download the appropriate NXLog install archive from the NXLog website.

  1. Log in to your account, then click My account at the top of the page.

  2. Under the Downloads > NXLog Enterprise Edition files tab, choose the nxlog-6.2.9212_docker.tar.gz archive (which is based on CentOS 7).

  3. Use SFTP or a similar secure method to transfer the archive to the target server.

  4. Log in to the target server and extract the contents of the archive.

    $ tar -xzf nxlog-6.2.9212_docker.tar.gz
    Table 1. Files in the Docker Archive
    Package Description

    Dockerfile

    The main NXLog Docker definition file

    README.md

    Readme for building NXLog Docker image

    nxlog-6.2.9212_rhel7_x86_64.tar.bz2

    The NXLog RHEL7 package

  5. Configure NXLog. Custom configuration files can be placed in the build directory of the NXLog Docker version, before the build. Every file ending with .conf will be copied into the Docker image and placed in the /opt/nxlog/etc/nxlog.d directory. The default NXLog configuration file includes all .conf files found in this directory.

  6. Build the NXLog Docker image.

    • The standalone version of NXLog Docker image can be built with this command.

      $ docker build -t nxlog .
    • It is also possible to specify the IP address of an NXLog Manager instance at build time. In this case, NXLog will connect automatically at startup. Before build, the CA certificate file, exported from NXLog Manager in PEM format and named agent-ca.pem, must be placed in the Docker build directory.

      $ docker build -t nxlog --build-arg NXLOG_MANAGER=<NXLOG-MANAGER-IP> .
  7. Run the container using the docker command.

    $ docker run -p <HostPort>:<ContainerPort> -d nxlog
  8. Check that the NXLog container is running with the docker command.

    $ docker ps | grep nxlog
    a3b4d6240e9d nxlog "/opt/nxlog/bin/nx..." 7 seconds ago Up 6 seconds 0.0.0.0:1514->1514/tcp cranky_perlman
    [...]

Upgrading

The upgrade process consists of creating a new NXLog Docker image build and running a new container instance with the newly built image.

  1. Follow steps 1-5 above to build a new Docker image.

  2. Get the container ID of the running NXLog instance and stop the running container.

    $ docker ps | grep nxlog
    $ docker stop <containerID>
  3. Run the new container using the docker command.

    $ docker run -p <HostPort>:<ContainerPort> -d nxlog
  4. Check that the new NXLog container is running.

    $ docker ps | grep nxlog
    a3b4d6240e9d nxlog "/opt/nxlog/bin/nx..." 7 seconds ago Up 6 seconds 0.0.0.0:1514->1514/tcp cranky_perlman
    [...]
  5. Any old containers and images that are no longer needed can be removed with docker rm -v <containerID> and docker rmi <imageID>, respectively. See Uninstalling below for more information.

Uninstalling

The uninstallation process of the NXLog Docker version is simply removing the running container and the image.

  1. Get the container ID of the running NXLog instance and stop the running container.

    $ docker ps | grep nxlog
    $ docker stop <containerID>
  2. Remove the stopped container.

    $ docker rm -v <containerID>
  3. Any other remaining containers that are not running can be listed with docker ps -a, and removed.

    $ docker ps -a | grep nxlog
    $ docker rm -v <containerID>
  4. Finally, list and remove NXLog Docker images.

    $ docker images
    $ docker rmi <containerID>