Configuring SQL Server destinations

Important:

Before your connections can successfully send data to a destination, your Tanium Cloud instance, network egress allow list, and network allow list must be configured. Note the following:

  • Sign in to your Tanium Account and configure a network egress allow list rule for each destination fully qualified domain name (FQDN) and associated port. For more information about how to configure the network egress allow list, see Configuring network egress for Tanium Cloud.

  • Review cloud egress destinations and ports to ensure that a destination FQDN and associated port are in the network egress allow list.

  • TCP traffic that does not use Server Name Indication (SNI) is limited to one destination per port. For example, SQL traffic and SMTP traffic do not use SNI.

  • TCP traffic is not supported for the following ports: 22, 25, 111, 3128, 3129, 3130, 4000, 5000, 6000, 9100, 9301, 9302, 9901, and 9902.

  • UDP traffic is not supported.

  • Your Tanium Cloud instance has a proxy cluster with 2 public IP addresses. If the destination is in your network, add inbound traffic from these IP addresses to your network allow list.

For more information, see Network egress. For assistance, contact Tanium Support.

You can use SQL Server destinations to store historical results for analysis and integration with third-party systems. You can forward the results from saved questions and other data sources to a database table.

System requirements

  • Microsoft SQL Server 2008 or later, Microsoft SQL Server 2008 Express or later

  • Database application server must be accessible from the Tanium Module Server

  • User credentials with db_ddladmin and db_datawriter role membership to an account on the Microsoft SQL Server that can insert data, create tables (optional), and run stored procedures (optional)

Set up the database

Decide whether to use an existing database or create a new database.

  1. Get the name of the database that you want to use for Connect. When you set up the destination, you can have Connect create a new table for your data or use an existing table.
  2. The user account that Connect uses for the database must have log in permissions to that database and the appropriate permissions to tables and stored procedures (optional) within that database.

    Both SQL Server Authentication and Windows Authentication are supported. Set up the following privileges:

    • For each user, create a User Mapping for the database.
    • For each database, grant the CREATE TABLE permission.
    • For each schema, grant the ALTER and INSERT permissions.
    • (Optional) For stored procedures, grant at least the EXECUTE permission.
  3. (Optional) Create stored procedures. You can create procedures that run before the first database table row is inserted or after the last row is inserted. Before you create the connection, these procedures and any associated parameters must exist in your database. The SQL user account must also have permission to run these procedures.

Sample SQL Script for creating stored procedures

PYTHON
GO
/****** Object: Table [dbo].[connection_log]  Script Date: 4/25/2017 8:02:32 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[connection_log](
  [connectionRunId] [bigint] NOT NULL,
  [connectionId] [bigint] NOT NULL,
  [connectionName] [nvarchar](200) NOT NULL,
  [source] [nvarchar](200) NOT NULL,
  [databaseTable] [nvarchar](100) NULL,
  [startTime] [datetime] NOT NULL,
  [endTime] [datetime] NULL,
  [runStatus] [nvarchar](20) NOT NULL,
  [expectedRowCount] [bigint] NOT NULL,
  [sourceRowCount] [bigint] NOT NULL,
  [destinationRowCount] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED
(
  [connectionRunId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
	ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: StoredProcedure [dbo].[sp_onConnectionFinish]  Script Date: 4/25/2017 8:02:32 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[sp_onConnectionFinish]
  @connectionRunId bigint,
  @runStatus nvarchar(20),
  @sourceRowCount bigint,
  @destinationRowCount bigint,
  @finishTime datetime
as
BEGIN
  update connection_log set runStatus = @runStatus, sourceRowCount = @sourceRowCount, 
	destinationRowCount = @destinationRowCount, endTime = @finishTime
  where connectionRunId = @connectionRunId
END
GO
/****** Object: StoredProcedure [dbo].[sp_onConnectionStart]  Script Date: 4/25/2017 8:02:32 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[sp_onConnectionStart]
  @connectionName nvarchar(200),
  @connectionId bigint,
  @connectionRunId bigint,
  @source nvarchar(200),
  @databaseTable nvarchar(100),
  @startTime datetime,
  @expectedRowCount bigint
AS
BEGIN
  if exists (select * from connection_log where ConnectionRunId = @connectionRunId) BEGIN
    delete connection_log where ConnectionRunId = @connectionRunId
  END
  insert into connection_log (connectionRunId, connectionId, connectionName, source, databaseTable, 
	startTime, endTime, runStatus, expectedRowCount, sourceRowCount, destinationRowCount)
  values (@connectionRunId, @connectionId, @connectionName, @source, @databaseTable, @startTime, null, 
	'Running', isnull(@expectedRowCount, 0), 0, 0)
END
GO

You can use the following parameters for pre-run stored procedures:

  • Connection Name: @connectionName

  • Connection ID: @connectionId

  • Connection Run ID: @connectionRunId

  • Source Name: @source

  • Database Table: @databaseTable

  • Start Time: @startTime

  • Expected Row Count: @expectedRowCount

You can use the following parameters for post-run stored procedures:

  • Connection Name: @connectionName

  • Connection ID: @connectionId

  • Connection Run ID: @connectionRunId

  • Source Name: @source

  • Database Table: @databaseTable

  • Start Time: @startTime

  • Expected Row Count: @expectedRowCount

  • Run Status: @runStatus

  • Source Row Count: @sourceRowCount

  • Destination Row Count: @destinationRowCount

  • Finish Time: @endTime

Note: The @runStatus parameter always returns Finished because the post-run stored procedure runs only after a successful connection run. The @endTime parameter is the time the stored procedure is executed, and is UTC formatted as ISO8601. The @databaseTable parameter is in the format of database schema.database table (for example, dbo.connection_log). The @expectedRowCount parameter could return NULL for sources other than saved questions.

Configure sending data to an on-premises destination that is not accessible from the external internet

Certain destinations support using a configured satellite to send data to an on-premises server that is not accessible from the external internet. Make sure that your environment meets the following requirements:

  • Tanium Client: 7.7.3.8176 or later

  • Tanium Direct Connect

    • Configure at least one satellite that can establish communications with the on-premises destination. For the best results, use a satellite with at least four processor cores and 16 GB of memory. Satellites with less memory might be sufficient for small data volumes. Satellite configuration requires the Direct Connect Satellite write permission. For more information, see Managing satellites.

  • Tanium Endpoint Configuration

    • Tanium Endpoint Configuration installs Client Extensions and other tools for Direct Connect on endpoints. Sending Tanium Cloud data using a configured satellite requires Core CX 2.15.1306 or later and DEC CX 2.10.1745 or later. For more information, see Client extensions.

  • To configure the connection destination, configure a custom role that includes the Direct Connect Satellite read and Client Stream write Direct Connect permissions. For more information, see Configure a custom role.

    Note: Assign the Sensor read permission for the Endpoint Configuration content set to users who need to configure satellites.
    • If a user has the Sensor read permission for the Endpoint Configuration content set, satellites that do not have the required versions of core-cx or dec-cx endpoint tools do not appear as options.

    • If a user does not have the Sensor read permission for the Endpoint Configuration content set, satellites that do not have the required versions of core-cx or dec-cx endpoint tools can still appear as options. If you select a satellite that does not have the required versions of the endpoint tools, an error appears when you try to save the connection.

    The Connect Operator system role contains the required permissions in addition to the Sensor read permission.

  • Ensure that each user is assigned the custom role, and has access to the computer group containing the satellite intended for sending data to an on-premises destination. For more information, see Manage computer group assignments for a user.

Note the following:

  • You can configure a bandwidth throttle to limit the bandwidth and the number of concurrent connections used to send data to satellites. For more information, see Managing bandwidth throttles.

  • You cannot configure a connection using a satellite until the satellite status updates to online. Satellites might take several minutes or more to update to online after configuration.

  • Connection sources that gather information from endpoints, such as the Saved Question source, must finish gathering information before the satellite connection is established.

  • The Retrieve Properties and Retrieve Columns buttons use the configured Connect Timeout advanced setting value. Because on-premises destinations might require more time to establish a connection, increase Connect Timeout to 60 seconds.

Specify general connection information

  1. From the Main menu, go to Modules > Connect > Overview. Go to the Connections section and click Create Connection.
  2. Enter a name and description for the connection.
  3. (Optional) In the General Information section, expand Advanced to configure the following settings:
    Log Level

    By default, Log Level is set to Information. To reduce the amount of logging, you can set Log Level to Warning, Error, or Fatal.

    Example Log Level setting
    Override Log Level

    If you are debugging the connection, select Override Log Level to set a Temporary Log Level (such as Trace or Debug) on this connection for a selected Number of Runs (up to 24). A scheduled or manual connection run, once started, counts towards the number of runs, regardless of the connection status. After the number of runs elapses, the logging for this connection returns to the Log Level you selected to prevent finer-grained logging from consuming additional resources for an indefinite number of runs.

    Minimum Pass Percentage

    Minimum percentage of the expected rows that must be processed for the connection to succeed.

    Memory Ceiling (GB)

    Maximum memory for the node process to run the connection. This defaults to 1 GB per connection, and cannot exceed the global maximum sum of memory for all running connections (by default, 8 GB). Increase this setting if a connection frequently exhibits out of memory errors while running.

    Note: If the sum of simultaneously scheduled connection Memory Ceiling values exceed the global Memory Ceiling, connections run until the global Memory Ceiling is reached, then any remaining connections enter a waiting queue if you select the Queue Connections configuration setting, or fail if you clear the Queue Connections configuration setting.

Configure the connection source

The connection source determines what data you are sending to the destination. This data is usually information from Tanium, such as a saved question, question log, client status, or event. The settings vary depending on which source you choose.

Figure 1. Connection source settings
Connection source settings
Note: After you create a connection, you cannot update the connection source type, only the source configuration. If you want to change the source type, create a new connection.

For more information about available connection sources, see Connection sources.

Configure SQL Server destination

Specify information about how to connect to your database application server, test the database application server connection, and configure which data is added to the database tables and rows.

Note: After you create a connection, you cannot update the connection destination type, only the destination configuration. If you want to change the destination, create a new connection.
Note: Each time that a connection to a SQL Server destination runs, if the configured destination table does not exist, then the connection attempts to create the table using the configured database user account. The user account must be a member of the db_ddladmin database role to create the table.
  1. In the Configuration section, select SQL Server for the destination.
  2. Enter the Server Name.
  3. (Optional) If you want to send data to a database application server that is deployed on-premises and is not accessible to the external internet, configure a satellite. Click + Add Satellite. Select a configured satellite that can communicate with the database application server. Then click Apply. To configure a satellite, see Managing satellites.
    Note: Connections configured to use a satellite to send data to an on-premises destination do not export with the satellite configuration. After you import the connection, re-configure the satellite for this connection.

    After you select a primary satellite, you can add up to four alternative satellites. Click Add Alternative Satellite, select the satellites that you want to add, and then click Apply. You can then reorder the alternative satellites in order of preference. When a connection run starts, Connect checks the primary satellite first. If the primary satellite does not answer, Connect uses the first alternative satellite that answers, in the order that the satellites appear in the list. Each satellite check times out after about 55 seconds. If no satellite answers, the connection run fails with the message No satellite reported online. A connection run does not change satellites after the run starts.

    Note: Alternative satellites have the following conditions:
    • A connection cannot have alternative satellites without a primary satellite. The primary satellite cannot also be an alternative satellite. Remove the alternative satellites before you remove the primary satellite. The list for the primary satellite does not include the alternative satellites. To make an alternative satellite the primary satellite, remove the satellite from the list of alternative satellites, and then select the satellite as the primary satellite. To make the primary satellite an alternative satellite, select a different primary satellite, and then add the previous primary satellite as an alternative satellite.
    • Only SQL Server destinations support alternative satellites. Destination profiles and Tanium Atlas do not support alternative satellites.
    • Alternative satellites do not export, and import does not support them. After you import a connection, add the alternative satellites to the connection again.
    • If Direct Connect does not return a satellite, such as a satellite that was deleted or a satellite outside your computer management rights, the satellite appears with the status Unknown and a warning appears below the list. Remove the satellite or select a different satellite.
    • If you do not have the Direct Connect Satellite read permission, the satellite section shows a warning about the missing permission, and the controls to add, change, and remove satellites are not available.
    • If Direct Connect does not return the primary satellite and no alternative satellite is online, the Retrieve Properties, Retrieve Stored Procedures, and Retrieve Columns buttons are disabled. The tooltip for each button directs you to check the satellite configuration.
  4. Enter the User Name and Password.
    Note: If a connection or connection setting shows Warning state-warning, configure a network egress allow list rule to match the configured destination FQDN or IP address and associated port. For more information about how to configure the network egress allow list, see Tanium Cloud User Guide: Configuring network egress for Tanium Cloud.
    Example configuration for an SQL Server destination

    Enter a hostname (such as sqlserver.domain.com) or IPv4 address (such as 192.0.2.10) in the Server Name field.

    If you want to add a custom port, append a comma followed by the port number in the format hostname, port_number (sqlserver.domain.com, 1434) or ip_address, port_number (such as 192.0.2.10, 1434).

    Note: You cannot configure a named instance directly because Tanium Cloud does not support UDP traffic. If you want to use a named instance as a destination, configure the named instance to use a static port number, then configure the connection with the hostname and static port number. For information about port configuration, see Microsoft SQL documentation: How to check if SQL Server is listening on a dynamic port or static port.
    Note: SQL Server traffic does not use SNI, and is limited to one destination per port in Tanium Cloud. If you deploy multiple SQL Server instances on different hosts listening on the same port, you can only configure a destination for one of the SQL Server instances listening on that port. Instead, configure a Microsoft Azure SQL Database instance that can replicate to other SQL Server instances, then configure a destination for your Microsoft Azure SQL Database instance. Alternatively, configure your SQL Server instances to listen on different custom ports, then configure a destination for each instance and custom port.

    If you are using Windows Authentication, specify the User Name in the following format: domain_name\login_name (such as domain_general\example_user).

  5. Specify the database application server properties or click Retrieve Properties to choose from those available on the server. If the connection to the database application server is successful, the fields for the database name, schema, and table appear.
    Note: The option to Retrieve Properties is disabled if there are no servers configured, or if the connection uses a satellite and no satellite is online.
  6. (Optional) To retrieve stored procedures without using Retrieve Properties, enter a value in the Database and Schema fields and then click Retrieve Stored Procedures.

    Connect retrieves the stored procedures and their parameters for the specified database and schema, and populates the Advanced section for the destination settings with the stored procedure fields.

    Example Advanced section with stored procedure fields
    Note: The option to Retrieve Stored Procedures is disabled if the connection uses a satellite and no satellite is online.
    Note: Use Retrieve Stored Procedures instead of Retrieve Properties when your SQL Server instance has a large number of properties and Retrieve Properties times out.
  7. (Optional) Click Retrieve Columns to populate the column values in the Columns section.
    Note: You must be a member of the db_ddladmin database role to retrieve columns from the server.
    Note: The option to Retrieve Columns is disabled if the connection uses a satellite and no satellite is online.
  8. (Optional) If you want to use encryption, select Encrypt and Validate server's TLS certificate to validate that the certificate is signed by a well-known, public certificate authority. If you want to use a self-signed certificate (not recommended) for testing purposes, deselect Validate server's TLS certificate.
    Important: Deselecting Validate server's TLS certificate is not recommended, because that allows any certificates to be accepted, including certificates that are not valid or malicious.
    Important: Validate server's TLS certificate is not supported if you configure a satellite to send data to an on-premises SQL Server server.
  9. (Optional) In the destination settings, expand Advanced to configure advanced settings.
    Note: Stored procedure fields and parameters are available only if your database already has stored procedures configured.
    Tip: For connections that use a satellite to connect to on-premises destinations that are not accessible from the external internet, note that the Retrieve Properties and Retrieve Columns buttons use the configured Connect Timeout advanced setting value. Because on-premises destinations might require more time to establish a connection, increase Connect Timeout to 60 seconds or more.
    Table 1. Advanced settings for SQL Server destinations

    Advanced setting

    Description

    Connect Timeout

    The maximum number of seconds to establish a network connection between the connection source and the SQL Server destination. A connection run fails if a network connection is not established within this timeout period.

    Request Timeout

    The maximum number of seconds to complete a batch request from the connection source to the SQL Server destination, after establishing a network connection. Each batch request contains a batch of rows from the connection source. A connection run fails if a batch request does not complete within this timeout period. A single connection run might send more than one batch request to the SQL Server depending on the Batch Size and the number of rows available.

    Batch Size

    The maximum number of rows sent per batch from the connection source to the SQL Server destination. If the total number of rows exceeds the defined Batch Size for a single connection run, the connection run sends multiple batch requests, waiting for one batch request to complete before sending the next batch request. This has no effect if one row or fewer is available to send in a connection run.

    Packet Size

    The Tabular Data Stream protocol (TDS protocol) packet size, used for communication between the connection source and the SQL Server destination. If set to 0, TDS protocol packet size is defined by the SQL Server setting (generally 4096 bytes).

    Multi-Subnet Failover

    For Always On cluster deployments only, better resolve the active server DNS name and improve performance in failover situations.

Configure filters

(Optional) In the Configure Output > Filters section, you can specify filters to modify the data that you are getting from your connection source before it is sent to the destination.

For more information about the types of filters you can configure, see Reference: Filtering options.

Map database table columns

(Optional) You can view and change the mapping of the data from your source to the columns in your database table.

If the source is a saved question, the following columns are also available for writing to the SQL Server destination:

  • Band Number: The source row number. When flattened, this number is in each row that is associated with a row number that is received from Tanium.

  • Row Number: The destination row number. This value is a counter for the rows that are output per connection run. The value is unique for each connection run.

In the Configure Output > Columns section, you can change the Destination Label of each column and Value Type to force the column to be a String, Numeric, or Date/Time value.

Figure 2. Columns section with Destination Label and Value Type fields
Columns section with Destination Label and Value Type fields

If you choose Numeric for the value, you can specify a default value that is used if the data cannot be coerced into a numeric value. You can specify any negative or positive number.

If you choose Date/Time for the value, specify the format that you want to use for the column. For more information about how to use a variable, see Time stamp variables.

For more information about column customizations, see Reference: Column customizations.

Note: You can export data in the MM/DD/YYYY, ISO 8601 with time zone, and ISO 8601 UTC (Zulu) date/time formats to database columns of type date, datetime2, datetimeoffset, nvarchar, or time. If you specify a destination column that does not exist in the destination database, it is created as type nvarchar.
Important: When you edit a connection with the SQL Server destination, the columns that are in the database are not shown by default. You can edit the text fields for the columns, but you must provide the User Name and Password and click Retrieve Columns in the Configuration section to view the columns from the database.

Your connection is listed on the Connect Overview page and data is sent to the Microsoft SQL Server at the interval you specified. You might want to check your database table to verify that the data is being exported correctly.

Schedule the connection

Connections can run at a highly configurable time interval, such as multiple times per hour, day, week, or month.

Important: Connections scheduled to run during a Tanium Cloud maintenance window might be interrupted or fail. Schedule your connections to run outside of the Tanium Cloud maintenance window.
Note: If you do not enable the schedule, the connection only runs when you manually run it, unless you configure an Event source. Connections with Event sources only run when a configured event is detected, and cannot be scheduled or manually run.

Use the Schedule section to update the schedule:

  • Select Enable schedule.

  • In the Schedule Type, select Basic to build a schedule with the provided controls.

  • To view or edit the cron expression directly, select Advanced - Define as a Cron Expression, and use the Advanced field to edit the cron expression.

Note: If a user that owns a scheduled connection is deleted, future scheduled instances of that connection do not run. For more information, see Issue: Scheduled connection owned by a deleted user no longer runs.

For more information about cron syntax, see Reference: Cron syntax for Connect.

Enable listening for an event

Connections with Event sources only run when a configured event is detected, and cannot be scheduled or manually run.

Use the Enablement section to send data when a configured event is detected:

  • Select Listen for this Event.

Save and verify connection

  1. After you enter the details for the connection, click Save.
    Tip: To save the connection and immediately run the connection, click Run and Save.

    If needed, resolve any errors or missing information. After the connection creates successfully, the connection details appear.

  2. To view details when the connection runs, click the Logs tab.
  3. To view an individual run log, expand the row table. For more information about how to resolve errors, see Troubleshooting.