NXLog fail to start on macOS

Tags:

#1 ygini

Hello

I'm using NXLog 5.6.7727 version for Apple Silicon

When I start the service as root manually with the CLI /opt/nxlog/bin/nxlog -f the service works and my logs are sent.

The same settings started with launchd works but don't send anything.

Any ideas why?

Here is my current configuration:

User nxlog
Group nxlog
Panic Soft

# default values:
define INSTALLDIR /opt/nxlog
PidFile %INSTALLDIR%/var/run/nxlog/nxlog.pid
CacheDir %INSTALLDIR%/var/spool/nxlog
ModuleDir %INSTALLDIR%/libexec/nxlog/modules
SpoolDir %INSTALLDIR%/var/spool/nxlog

define CERTDIR %INSTALLDIR%/var/lib/nxlog/cert
define CONFDIR %INSTALLDIR%/etc/nxlog.d

# Note that these two lines define constants only; the log file location
# is ultimately set by the `LogFile` directive (see below). The
# `MYLOGFILE` define is also used to rotate the log file automatically
# (see the `_fileop` block).
define LOGDIR %INSTALLDIR%/var/log/nxlog
define MYLOGFILE %LOGDIR%/nxlog.log

<Extension _json>
    Module xm_json
</Extension>

<Extension gelf>
    Module        xm_gelf
</Extension>

<Input macos_es>
    Module              im_maces
    NotifyEvents    All
    <Exec>
        $Hostname = hostname();
        to_json();
    </Exec>
</Input>

<Input macos_uls>
    Module              im_maculs
    UUIDTextPath        "/var/db/uuidtext"
    <Exec>
        if $subsystem == 'com.apple.SkyLight'
        {
            drop();
        }
        $Hostname = hostname();
        to_json();
    </Exec>
</Input>

<Output graylog>
    Module        om_tcp
    Host          10.0.0.10:12201
    OutputType    GELF_TCP
</Output>

<Route Mac2Graylog>
    Path        macos_uls, macos_es => graylog
</Route>
#2 NenadMDeactivated Nxlog ✓
#1 ygini
Hello I'm using NXLog 5.6.7727 version for Apple Silicon When I start the service as root manually with the CLI /opt/nxlog/bin/nxlog -f the service works and my logs are sent. The same settings started with launchd works but don't send anything. Any ideas why? Here is my current configuration: User nxlog Group nxlog Panic Soft # default values: define INSTALLDIR /opt/nxlog PidFile %INSTALLDIR%/var/run/nxlog/nxlog.pid CacheDir %INSTALLDIR%/var/spool/nxlog ModuleDir %INSTALLDIR%/libexec/nxlog/modules SpoolDir %INSTALLDIR%/var/spool/nxlog define CERTDIR %INSTALLDIR%/var/lib/nxlog/cert define CONFDIR %INSTALLDIR%/etc/nxlog.d # Note that these two lines define constants only; the log file location # is ultimately set by the `LogFile` directive (see below). The # `MYLOGFILE` define is also used to rotate the log file automatically # (see the `_fileop` block). define LOGDIR %INSTALLDIR%/var/log/nxlog define MYLOGFILE %LOGDIR%/nxlog.log <Extension _json> Module xm_json </Extension> <Extension gelf> Module xm_gelf </Extension> <Input macos_es> Module im_maces NotifyEvents All <Exec> $Hostname = hostname(); to_json(); </Exec> </Input> <Input macos_uls> Module im_maculs UUIDTextPath "/var/db/uuidtext" <Exec> if $subsystem == 'com.apple.SkyLight' { drop(); } $Hostname = hostname(); to_json(); </Exec> </Input> <Output graylog> Module om_tcp Host 10.0.0.10:12201 OutputType GELF_TCP </Output> <Route Mac2Graylog> Path macos_uls, macos_es => graylog </Route>

Have you checked the NXLog's internal logs file. It has been set in the configuration file:

define LOGDIR %INSTALLDIR%/var/log/nxlog define MYLOGFILE %LOGDIR%/nxlog.log

Please check /opt/nxlog/var/log/nxlog/nxlog.log. There should be a clue ie. configuration problem, a sysntax error, permissions...

My best bet is the permissions. You are running the service as root manually...but the config file is set to run the service as the nxlog user: User nxlog Group nxlog