Return to
Portfolio

15. Apple macOS

15.1. Installing

To install NXLog under macOS, follow the steps below. You will need administrator privileges to complete the installation process.

  1. Download the appropriate NXLog install package 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 correct package for your system.

      Table 21. Available macOS Packages
      Platform Package

      macOS 10.14 and earlier (pre-Catalina)

      nxlog-4.6.4661_macos-precatalina.pkg

      macOS 10.15 and later

      nxlog-4.6.4661_macos.pkg

  2. Optional: To change the NXLog user and group for the installation, create a /tmp/.nxlog file with the following command. The specified user and group will be created, used for the User and Group directives under nxlog.conf, and used 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.

    $ echo 'nxlog2:nxlog2' > /tmp/.nxlog
  3. Install the NXLog package. You can do the installation interactively or with the command line installer.

    • To install interactively, double-click the NXLog package.

      As of version 4.5 the installer should be signed with our developer certificate. If you see the following message with an earlier version, go to System Preferences  Security & Privacy and click Open Anyway, then follow the instructions shown by the installer.

      "nxlog-4.6.4661_macos.pkg" can’t be opened because it is from an unidentified developer.

      Allow NXLog to launch the installer
    • To install the package using the command line installer, run the following command.

      $ sudo installer -pkg nxlog-4.6.4661_macos.pkg -target /
      Password:
      installer: Package name is nxlog-4.6.4661-macos-x86
      installer: Upgrading at base path /
      installer: The upgrade was successful.

    Upon installation, all NXLog files are placed under /opt/nxlog. The launchd(8) script is installed in /Library/LaunchDaemons/com.nxlog.plist and has the KeepAlive flag set to true (launchd will automatically restart NXLog). NXLog log files are managed by launchd and can be found in /var/log/.

  4. Configure NXLog by editing /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 macOS, see the Apple macOS summary.

  5. Verify the configuration file syntax.

    $ sudo /opt/nxlog/bin/nxlog -v
    2017-03-17 08:05:06 INFO configuration OK
  6. To apply your changes, stop NXLog with the following command. The launchd manager will restart the daemon and the new configuration will be loaded.

    $ sudo launchctl stop com.nxlog
  7. To permanently stop NXLog, the service must be unloaded.

    $ sudo launchctl unload /Library/LaunchDaemons/com.nxlog.plist

15.2. Upgrading

To upgrade NXLog, follow the installation instructions.

The installation script will not modify the configuration files, and the script will restart NXLog after the installation is completed.

Note
The same user and group will be used for the upgrade as was used for the original installation (see installation step 2 above). Changing to a different user and group during upgrade is not supported.

15.3. Uninstalling

To properly uninstall NXLog, follow these steps.

  1. Start the uninstaller script as user root.

    Warning
    This will remove any custom configuration files, certificates and other files in the listed directories. Save these files to another location first if you do not wish to discard them.
    $ sudo bash /opt/nxlog/bin/uninstaller -y
    Note
    Use -n switch if you would like to preserve user data.
  2. Delete user data if you are sure it will not be needed anymore.

    $ sudo rm -rf /opt/nxlog

To manually uninstall NXLog, follow these steps below.

  1. Unload the daemon.

    $ sudo launchctl unload /Library/LaunchDaemons/com.nxlog.plist
  2. Delete the nxlog user and group that were created during installation. If a non-default user/group were used during installation (see installation step 2 above), remove those instead.

    $ sudo dscl . -delete "/Groups/nxlog"
    $ sudo dscl . -delete "/Users/nxlog"
  3. Remove NXLog files.

    Warning
    This will remove any custom configuration files, certificates and other files in the listed directories. Save these files to another location first if you do not wish to discard them.
    $ sudo rm -rf /opt/nxlog /Library/LaunchDaemons/com.nxlog.plist \
                  /var/log/nxlog.std* && \
      sudo pkgutil --forget com.nxlog.agent