On This Page

Home / Stream/ Integrations/ Sources/ Collector Sources/ Using Collectors/Configure a Database Connection

Configure a Database Connection

Database Connections are reusable configuration objects in Cribl Stream that enable Database Collectors to access and retrieve data from a MySQL, Oracle, Postgres, or SQL Server database. You can reference the same Database Connection in multiple Database Collectors, which helps streamline Database Collector setup.

Overview of Database Collector Configuration

The workflow for setting up a new Database Collector has these phases:

  1. Create a Connection String or Configuration Object: Before you start, you need to gather access and authentication information for your database. Using that information, build a connection string or configuration object that you will use to establish a valid connection to the database.

  2. Configure a Database Connection: Database Collectors rely on Cribl Stream Database Connections, which are reusable objects that you can re-use with multiple Database Collectors to authenticate to the same database.

  3. Test the Connection: Ensure the Database Connection is configured correctly and that data is flowing.

  4. Configure a Database Collector: Configure a Database Collector to input data from an upstream database. You can then route this data to a Pipeline for further data processing.

Create a Connection String or Configuration Object

To get started with a Database Collector, you need to gather important details and authentication information about your target database. Using that information, you can build a connection string. A connection string is a structured text string that contains all the required parameters for Cribl Stream to establish a valid connection to the database.

In addition to connection strings, SQL Server databases can also accept a configuration object, which is a structured data format (such as JSON) that organizes the required database access into defined fields.

Connection strings should be properly escaped, especially when your password might contain a special character. For example, characters like @, :, /, ?, #, or % may be interpreted as delimiters inside a URI. If they aren’t escaped, the connection string can break or fail to authenticate. Use percent-encoding (URL encoding) for these characters. For example, a password of MyP@ssw0rd! would be encoded into MyP%40ssw0rd%21.

For information about creating connection strings, jump to the section for your database type:

MySQL, Oracle, and Postgres

Select the appropriate tab for information about building a connection string for these database types:

MySQLOraclePostgres

SQL Server

The necessary requirements for SQL Server depend on how you will authenticate Cribl Stream with the server. Select the appropriate tab for your authentication type:

Service PrincipalNTLM

Configure a Database Connection

After creating a connection string or configuration object for your database type, the next step is to configure a Database Connection for the target database. Database Connections are reusable Knowledge objects that you can use and re-use to connect the same database to multiple Database Collectors as needed.

When you change a Database Connection, it impacts all Database Collectors that use that Database Connection. Make changes with caution.

To configure or update a Database Connection:

  1. Select Worker Groups from the sidebar, and choose a Worker Group. Then, on the Worker Groups submenu, select Processing, then Knowledge, then Database Connections. Select Add Database Connection.

    You can also create a new Database Connection directly from a Database Collector. While configuring a Database Collector, select Create next to the Connection field to open the New Database Connection modal.

  2. In the New Database Connection modal, configure the following settings:

    • ID: Enter a unique ID for this connection. A descriptive ID will help all users recognize the connection by purpose.

    • Database type: Select your database type: MySQL, SQL Server, Postgres, or Oracle.

    • Authentication method: The available options available depend on your database type:

      Authentication MethodDescription
      Connection StringEnter the connection string you created in the previous Create a Connection String or Configuration Object step.
      Connection String SecretRather than storing the connection string in the Database Connection object, you can add it to secret store and then select the stored connection string. Select Create to add it to the secret store.
      Config (SQL Server only)Enter the JSON connection configuration object you created in the previous Create a Connection String or Configuration Object step. The object uses the Tedious driver and the node-mssql client.
      Stored Credentials (Oracle only)Use the secret store for both your database login and connection details. Select a username and password secret for the Credentials secret field and a text secret for the Connection string secret field to ensure secure, centralized management.
    • TLS (Oracle only): When the selected database type is Oracle, a TLS section appears for configuring mutual TLS (mTLS). See Configure Oracle mTLS for details.

      Connection strings should be properly escaped, especially when your password might contain a special character. For example, characters like @, :, /, ?, #, or % may be interpreted as delimiters inside a URI. If they aren’t escaped, the connection string can break or fail to authenticate. Use percent-encoding (URL encoding) for these characters. For example, a password of MyP@ssw0rd! would be encoded into MyP%40ssw0rd%21.

  3. Optionally, configure the Additional Settings:

    • Connection timeout (ms): How long, in milliseconds, Cribl Stream should wait before assuming that a connection has failed. This defaults to 10000 (10 sec.) for MySQL databases, and to 15000 (15 sec.) for SQL Server databases. For both, the minimum allowed value is 1000 (1 sec.), and the maximum is 60000 (1 minute).

    • Request timeout (ms): This setting appears only where Database type is set to SQL Server. Defines how long Cribl Stream should wait before assuming that a request has failed. If a query requires a longer timeout than the default 15000 (15 seconds), be sure that you know why. Long-running queries can affect other parts of the system. The minimum is 1000 (1 second).

  4. Select Save to save your changes.

Validate that your Database Connection is working as expected and that data is flowing by testing your connection, as explained in the next section.

Test the Connection

You can test the connection to the database inside the Database Connection by selecting the Test Connection button inside the Database Connection object. This initiates an API call that pings the database to check whether the connection is valid.

Be aware that when you select Test Connection on the Leader Node, the system only tests the database connection for the Leader Node itself. However, the Leader Node is usually not the node that needs to connect to the database while collecting data. Usually that operation is performed by a Worker Node.

To test the connection from a specific Worker Node:

  1. Ensure the Database Connection is committed and deployed.

  2. Teleport to the Worker Node and open the Database Connection on that Worker Node.

  3. Select Test Connection.

    • Success: If the test is successful, a success message displays in the lower right corner of the screen.
    • Failure: If the test fails, an error message display at the top of the screen. Connection test failures are logged in the logs for the Worker Group.

If the connection fails, check that the IP for the Worker Node is on the allow list for that database.

Configure Oracle mTLS

Cribl Stream supports mutual TLS (mTLS) for Oracle Database Connections operating in THIN mode. mTLS requires the Oracle server to present a valid certificate and requires Cribl Stream to present a client certificate during the TLS handshake.

Prerequisites

Before configuring mTLS for an Oracle connection, verify the following:

  • Oracle server configured for TCPS: The Oracle listener must accept TCPS connections. Port 2484 is the officially registered TCPS port, but the actual port depends on your listener configuration. Confirm the port and service name with your database administrator.

  • Client certificate in Cribl Stream: The TLS client certificate and private key must be stored in the Cribl Stream certificate store. Go to Settings > Security > Certificates to add the certificate. The certificate must be in PEM format.

  • Connect string uses the tcps protocol: The connection string must specify tcps as the protocol. See mTLS (TCPS) Connection Strings for examples.

TLS Settings

When Database type is set to Oracle, a TLS section appears in the Database Connection form. Configure the following fields:

FieldDescription
TLS (toggle)Enable to activate the TLS section and configure mTLS.
CertificateSelect the client certificate to present during the TLS handshake. This list is populated from certificates managed under Settings > Security > Certificates.
Reject UnauthorizedWhen enabled (default), Cribl Stream validates the Oracle server’s TLS certificate. Disable only in controlled test environments where the server uses a self-signed certificate.

Configure an Oracle mTLS Connection

  1. Add the client certificate to the Cribl Stream certificate store at Settings > Security > Certificates, if not already present.

  2. Follow the steps in Configure a Database Connection to open the New Database Connection modal and set Database type to Oracle.

  3. In the Authentication method dropdown, select Connection String, then enter a tcps connect string in the field that appears, for example:

    (DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=oracle-prod.corp.net)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=FINANCE_PDB1)))
  4. Under TLS, toggle TLS on to expand the TLS settings.

  5. In the Certificate dropdown, select the client certificate you added in step 1.

  6. Leave Reject Unauthorized enabled unless the Oracle server uses a self-signed certificate in a controlled test environment.

  7. Select Save, then commit and deploy.

Next Steps

After configuring a Database Connection and validating that data is flowing, you can then configure a Database Collectors to access and retrieve data from a MySQL, Oracle, Postgres, or SQL Server database.