FreeBSD

This topic describes the steps to install and upgrade NXLog on FreeBSD.

Installing

NXLog is available as a precompiled package for FreeBSD. Follow these steps to install NXLog.

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-5.5.7538_fbsd_x86_64.tgz package.

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

  4. Log in to the target server as the root user.

  5. Optional: To change the NXLog user and group for the installation, set the NXLOG_USER and NXLOG_GROUP environment variables. During installation a new user and and a new group will be created based on these environment variables. They will be used for User and Group directives in nxlog.conf, and for the ownership of some directories under /opt/nxlog. Specifying an already existing user or group is not supported. The created user and group will be deleted on NXLog removal.

    # setenv NXLOG_USER nxlog2
    # setenv NXLOG_GROUP nxlog2
  6. Install NXLog with the pkg(7) utility.

    # pkg add nxlog-5.5.7538_fbsd_x86_64.tgz
    Installing nxlog-5.5.7538-fbsd...
    Extracting nxlog-5.5.7538-fbsd: 100%

    The installation path is /opt/nxlog. Configuration files are located in /opt/nxlog/etc. The rc init script is placed in /etc/rc.d/ on installation. An nxlog user account is created, and NXLog will run under this user by default.

  7. Edit the configuration file.

    # vi /opt/nxlog/etc/nxlog.conf

    General information about configuring NXLog can be found in Configuration. For more details about configuring NXLog to collect logs on BSD, see the FreeBSD summary.

  8. Verify the configuration file syntax.

    # /opt/nxlog/bin/nxlog -v
    2017-03-17 08:05:06 INFO configuration OK
  9. To enable NXLog, add the line nxlog_enable="YES" to /etc/rc.conf. Then manage the NXLog service with the service(8) utility.

    # service nxlog start
    # service nxlog status
    nxlog is running as pid 83708.
    # service nxlog stop
    process 83708 stopped

Upgrading

To upgrade NXLog, first remove the old version and then install the new version. Make a backup of the configuration files before starting this process to be able to use them with the new installation.

  1. Remove the installed version of NXLog with the pkg(7) utility.

    # pkg delete nxlog
    Checking integrity... done (0 conflicting)
    Deinstallation has been requested for the following 1 packages (of 0 packages
    in the universe):
    
    Installed packages to be REMOVED:
    	nxlog-5.5.7538-fbsd
    
    Number of packages to be removed: 1
    
    The operation will free 39 MiB.
    
    Proceed with deinstalling packages? [y/N]: y
    [1/1] Deinstalling nxlog-5.5.7538-fbsd...
    [1/1] Deleting files for nxlog-5.5.7538-fbsd: 100%
  2. Install the new version as described in the installation instructions above.

    # pkg add nxlog-5.5.7538_fbsd_x86_64.tgz
    Installing nxlog-5.5.7538-fbsd...
    Extracting nxlog-5.5.7538-fbsd: 100%
  3. Restart the NXLog service.

    # service nxlog restart

Uninstalling

  1. Use the pkg(7) utility to uninstall the NXLog package.

    # pkg delete nxlog
    Updating database digests format: 100%
    Checking integrity... done (0 conflicting)
    Deinstallation has been requested for the following 1 packages (of 0 packages
    in the universe):
    
    Installed packages to be REMOVED:
    	nxlog-5.5.7538-fbsd
    
    Number of packages to be removed: 1
    
    The operation will free 92 MiB.
    
    Proceed with deinstalling packages? [y/N]: y
    [1/1] Deinstalling nxlog-5.5.7538-fbsd...
    [1/1] Deleting files for nxlog-5.5.7538-fbsd: 100%

    The uninstall script will remove NXLog along with the user, group, and files. The pkg utility will not remove new or modified files.

  2. Manually remove the base directory. This will remove any new or modified files left behind by the previous step.

    # rm -rf /opt/nxlog