Hello there,

nxlog currently does not compile out of the Box on FreeBSD.

  • It assumes that pthread_t can be cast to an unsigned long (on FreeBSD it' an opaque typedef to struct pthread *)
  • It uses SSLv3_method which is gone from newer versions of OpenSSL.

This can be fixed by applying the patch at the end of this posting.

I'd like to submit a FreeBSD port for nxlog, but I do need more information on what you consider okay and not okay wrt. to distribution.

As far as §4 (ii) of the license goes, the patch would need to include "you must include a prominent notice that you
have modified the file, including your name, your e-mail address (if any), and the date and purpose of the change;".

I would consider this making the patch more brittle, so I'd like to avoid it.

It would be better to actually have these changes upstream.

The use of pthread_getthreadid_np() is non-portable, which I'd like to replace with proper calls to CRYPTO_THREADID_set_callback() after some more testing.

Kind regards,



--- src/common/ssl.c.orig    2014-07-19 15:52:06.000000000 +0200
+++ src/common/ssl.c    2017-07-12 20:10:38.983907000 +0200
@@ -10,6 +10,9 @@
 #include "../core/nxlog.h"
 #include "error_debug.h"
 #include "ssl.h"
+#ifdef __FreeBSD__
+#include <pthread_np.h>
+#endif /* !__FreeBSD__ */
@@ -43,7 +46,13 @@
     unsigned long ret;
+#ifdef __FreeBSD__
+    pthread_t    thr;
+    thr = apr_os_thread_current();
+    ret = (unsigned long)pthread_getthreadid_np();
     ret = (unsigned long) apr_os_thread_current();
+#endif /* !__FreeBSD__ */
     return ( ret );
@@ -369,7 +378,7 @@
     throw_msg("error allocating BIO from socket");
-    meth = SSLv3_method();
+    meth = TLS_method();
     if ( meth == NULL )
     nx_ssl_error(FALSE, "failed to init SSLv23");


AskedJuly 12, 2017 - 9:27pm

Answer (1)

Hello Peter,

I believe the issues might be already fixed in our internal branch of the Community Edition that the above patch is targetting. In order to make it easier for the community to use and contribute, we will put up a public git repository shortly (as the current source code is already quite outdated). When that's done I think it would be nice to have a port submitted so that the code is more up-to-date, otherwise we will be happy to help if you'd like to do it now.

BTW, we already have official binary packages of the NXLog Enterprise Edition for FreeBSD.



Comments (6)

  • dhke's picture

    Hello Botond,

    The port currently needs a little bit more work since it does not properly pick up PCRE from when not in /usr (as on FreeBSD) and I don't really like to hack  use to work around that ;-).

    Given that I now have a local version for testing that compiles and runs, I don't see any problem in waiting until you open up the source repository. Any timeframe on that?

    Kind regards,


  • b0ti's picture

    If you'd like to test the trial of the NXLog Enterprise Edition please let me know and we'll set you up with access to the FreeBSD binary package.
    We are currently working on some additional enhancements such as BSM auditing for *BSD in case that might be also of interest.

  • Biggsy's picture

    Many thanks for the offer.  It's early days for me - I have just been looking at ways to get rid of a Windows VM.  It was only Windows originally because I ran Kiwi syslog server there.  NXLog nows runs in place of Kiwi but the system also runs a bunch of other things that, potentially, I could migrate to a FreeBSD VM.  I need to plan that migration but finding time is the problem. 

    Is it likely that the Community Edition will find its way into FreshPorts?  It sounds like the OP was intending to do that.

  • Biggsy's picture

    Hi b0ti,

    Just wondering whether there had been any further developments or discussions with Peter regarding a FreeBSD port of the Community Edition.

    Some recent events have convinced me that I really must move away from the Windows platform for logging.  Sadly, I'm not technically knowledgeable enough to do much more than a "pkg install nxlog" and import/modify my existing nxlog.conf.   I guess I could move to a Linux distro but it makes more sense for me to use an existing, underutilized FreeBSD VM.

    Thanks and regards,


  • b0ti's picture

    As stated above there well be a public repository which could help others to contribute easier, e.g. on the FreeBSD ports packaging. We also have plans to put up some other contrib stuff. Unfortunately I can't give you a timeframe as this is a volunteer effort. If you want an SLA we do offer commercial support and the NXLog EE with a binary package for FreeBSD that can be easily installed.