Skip to main content

Supported Data Types

📘 Logs | 📈 Metrics | 🚦 Traces

Snowflake Destination Configuration

FieldTypeDefaultRequiredDescription
NamenonetrueUnique identifier within Sawmills.
Account IDStringnonetrueThe account identifier number of the Snowflake account to which telemetry data will be sent.
UsernameStringnonetrueThe username for the account used by the Destination to authenticate with Snowflake.
PasswordStringnonetrueThe password for the account used by the Destination to authenticate with Snowflake.
RoleStringnonefalseThe Snowflake role the exporter should use to obtain the correct permissions; specify this only if the user’s default role does not have the necessary permissions.
Data WarehouseStringnonetrueThe Snowflake data warehouse that should be used for storing telemetry data.
Database NameStringtelemetryfalseThe Snowflake database where the destination will store telemetry data; it will create the database if it doesn’t exist.
Schema NameStringlogsfalseSchema in which to store the log table.
Database TableStringdatafalseTable in which to store the log table.

Prerequisites

  • A Snowflake account with a database, warehouse, and user.
  • A Sawmills Collector instance.
  • Network connectivity between the source and destination clusters.

Snowflake Setup Script

The following SQL script creates the necessary user, role, and permissions in Snowflake. Each section performs specific setup tasks:
begin;
   /* Set variables for script. Replace the values in {brackets} with your own values */
   set var_user = '{user}';         -- Username for the Sawmills service account
   set var_password = '{password}'; -- Secure password for the service account
   set var_role = '{role}';         -- Name of the role to be created (e.g., 'SAWMILLS_ROLE')
   set var_database = '{database}'; -- Database where telemetry will be stored
   set var_warehouse = '{warehouse}'; -- Warehouse to be used for data processing

   /* Create and configure Sawmills role and user */
   use role securityadmin;          -- Switch to security admin to manage roles and users
   create role if not exists identifier($var_role);
   grant role identifier($var_role) to role SYSADMIN;

   create user if not exists identifier($var_user)
   password = $var_password
   default_role = $var_role
   default_warehouse = $var_warehouse;

   grant role identifier($var_role) to user identifier($var_user);

   /* Grant necessary permissions */
   use role accountadmin;           -- Switch to account admin for granting warehouse access

   grant USAGE                      -- Allow the role to use the warehouse
   on warehouse identifier($var_warehouse)
   to role identifier($var_role);

   grant CREATE SCHEMA, MONITOR, USAGE  -- Grant database-level permissions
   on database identifier($var_database)
   to role identifier($var_role);

 commit;
This script performs the following actions:
  1. Variable Setup: Defines variables for all the configurable values needed in the script.
  2. Role Creation:
    • Switches to the securityadmin role for security-related operations
    • Creates a new role for Sawmills if it doesn’t exist
    • Grants the new role to SYSADMIN for management purposes
  3. User Creation:
    • Creates a new user account for Sawmills
    • Sets the default role and warehouse for the user
    • Associates the newly created role with the user
  4. Permission Setup:
    • Switches to accountadmin for granting warehouse access
    • Grants warehouse usage permissions to the role
    • Grants necessary database permissions (CREATE SCHEMA, MONITOR, USAGE) to the role
After running this script, your Snowflake environment will be properly be configured for use with Sawmills.

How to get the account ID:

  1. Login to your Snowflake account.
  2. Click on the user menu in the bottom-left corner and select Account.
  3. Hover over the Account you want to use and copy the Account Identifier.
  4. Replace the . with - in the account identifier.