syslog-ng documentation

Your main source of knowledge

The syslog-ng product family has an extensive documentation, covering everything from how to install a product to the most complex configuration and settings descriptions. If you cannot find an answer to your question, try the mailing list - our community is always eager to help.

syslog-ng Premium Edition

Contents

7.8.1. Procedure – How syslog-ng PE connects the MongoDB server

When syslog-ng PE connects the MongoDB server during startup, it completes the following steps.

  1. The syslog-ng PE application connects the first address listed in the servers() option.

    • If the server is accessible and it is a master MongoDB server, syslog-ng PE authenticates on the server (if needed), then starts sending the log messages to the server.

    • If the server is not accessible, or it is not a master server in a MongoDB replicaset and it does not send the address of the master server, syslog-ng PE connects the next address listed in the servers() option.

    • If the server is not a master server in a MongoDB replicaset, but it sends the address of the master server, syslog-ng PE connects the received address.

  2. When syslog-ng PE connects the master MongoDB server, it retrieves the list of replicas (from the replSet option of the server), and appends this list to the servers() option.

    Warning
    • This means that syslog-ng PE can send log messages to addresses that are not listed in its configuration.

    • Make sure to include the address of your master server in your syslog-ng PE configuration file, otherwise you risk losing log messages if all the addresses listed in the syslog-ng PE configuration are offline.

    • Addresses retrieved from the MongoDB servers are not stored, and can be lost when syslog-ng PE is restarted. The retrieved addresses are not lost if the server() option of the destination was not changed in the configuration file since the last restart.

    • The failover mechanism used in the mongodb() driver is different from the client-side failover used in other drivers.

  3. The syslog-ng PE application attempts to connect another server if the servers() list contains at least two addresses, and one of the following events happens:

    • The safe-mode() option is set to no, and the MongoDB server becomes unreachable.

    • The safe-mode() option is set to yes, and syslog-ng PE cannot insert a log message into the database because of an error.

    In such case, syslog-ng PE starts to connect the addresses in from the servers() list (starting from the first address) to find the new master server, authenticates on the new server (if needed), then continues to send the log messages to the new master server.

    During this failover step, one message can be lost if the safe-mode() option is disabled.

  4. If the original master becomes accessible again, syslog-ng PE will automatically connect to the original master.