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.
-
Download the appropriate NXLog install package from the NXLog website.
-
Log in to your account, then click My account at the top of the page.
-
Under the
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
-
-
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 undernxlog.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
-
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
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.
-
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
. Thelaunchd(8)
script is installed in/Library/LaunchDaemons/com.nxlog.plist
and has theKeepAlive
flag set totrue
(launchd will automatically restart NXLog). NXLog log files are managed by launchd and can be found in/var/log/
. -
-
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. -
Verify the configuration file syntax.
$ sudo /opt/nxlog/bin/nxlog -v 2017-03-17 08:05:06 INFO configuration OK
-
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
-
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.
-
Start the uninstaller script as user
root
.WarningThis 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
NoteUse -n
switch if you would like to preserve user data. -
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.
-
Unload the daemon.
$ sudo launchctl unload /Library/LaunchDaemons/com.nxlog.plist
-
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"
-
Remove NXLog files.
WarningThis 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