The MongoDB destination receives a face-lift

Reasons behind the migration

We have migrated to the official mongo-c-driver binding for providing the MongoDB destination driver in syslog-ng 3.8. Previously in syslog-ng 3.7.x and earlier, libmongo-client provided this binding, mandating its own special syntax.

This change will facilitate future-proof and more fine-grained configuration. MongoDB 3 is not officially supported or being tested yet, but this kind of connection should theoretically enable easy MongoDB 3 support in the future.

What to do when using legacy syntax

If you have used legacy syntax in your configuration file, syslog-ng will substitute the given deprecated options to form a URI. Note that certain aspects of semantics could also differ between the two drivers.

Therefore, you should analyze the behavior of your deployed system to ensure that the subtle changes in semantics do not cause any regressions. A non-exhaustive list of aspects to consider:

  • replica set formation
  • health checks
  • failure handling
  • reconnection
  • asynchronous operation
  • timeouts
  • sanitization
  • caching & buffering

Deprecated options and substitutes

Recommended mongodb() destination option substitutes

Use the following options for the mongodb() destination:

  • collection
  • uri

You can refer to the documentation for more information about the format of the connection URI string:

Inherited options are not affected, therefore they can be used as before and as described in the documentation. (for example, frac-digits(), local-time-zone(), log-fifo-size(), on-error(), retries(), throttle(), value-pairs(), and so on)

The deprecated options of mongodb() destination

Here is the list of deprecated options and their new substitutes:

database() (DEPRECATED)


  • uri('mongodb://')


host(''), port(1234)

  • uri('mongodb://')



  • uri('mongodb:///tmp/mongo.sock')

password() (DEPRECATED)


  • uri('mongodb://')

servers() (DEPRECATED)

servers('', '')

  • uri('mongodb://,')

username() (DEPRECATED)


  • uri('mongodb://')

safe_mode() (DEPRECATED)


The original intention of this option was to support asynchronous operation where records can be output without waiting for acknowledgement.

See the MongoDB URI documentation for available settings that could influence such aspects of operation.

For example, you can disable write concern and set timeouts by specifying:

  • uri('mongodb://')

Leave a Reply