Configuration in Python

You can adjust Sqreen settings according to your needs. This section lists the possible configuration options you have with the Sqreen Python agent.

Configuration methods and precedence

The Sqreen agent reads its configuration from different places. This is the order of precedence:

  • Environment variables
  • A sqreen.ini file
  • Default configuration options

The sqreen.ini file can be in:

  • Your application top level directory
  • In a custom location set by SQREEN_CONFIG_FILE environment variable:
export SQREEN_CONFIG_FILE=/custom/path/sqreen.ini

Deploying Sqreen configuration

Deploy the configuration file on the servers running Sqreen

Configuration variables

Find your organization token by going to Account Settings > Tokens in your Sqreen dashboard, or ( Your token has the prefix org_.

To help Sqreen identify the application when you use an organization token, you also need to set a unique application name.

You can provide this information using the SQREEN_TOKEN and SQREEN_APP_NAME environment variables.

When using the application token, only the SQREEN_TOKEN is required.

Application tokens deprecated

Application tokens are unique to an application. Organization tokens are available throughout the organization your account belongs to.

While Sqreen will continue to support application tokens for backward compatibility in the short term, they are now deprecated, and we encourage you to convert your applications to use organization tokens as soon as possible.

Follow this how-to to migrate applications using an application token.

Env variable name Role INI key name Default value
SQREEN_TOKEN The Sqreen token. This identifies the agent to Sqreen backend servers token Empty
SQREEN_APP_NAME The application name as displayed within the Sqreen dashboard app_name Empty
SQREEN_CONFIG_FILE Custom location for the .ini based config Empty
SQREEN_DISABLE Disable the Sqreen agent initialization. disable Empty
SQREEN_LOG_LOCATION Specify a custom file to write Sqreen logs log_location Empty
SQREEN_LOG_LEVEL Sqreen logging level log_level CRITICAL
SQREEN_HTTP_PROXY HTTP proxy server http_proxy Empty
SQREEN_IP_HEADER HTTP header used to determine the client IP address (e.g. X-Forwarded-For) ip_header Empty
SQREEN_STRIP_SENSITIVE_DATA Remove sensitive data before sending them to Sqreen strip_sensitive_data 1
SQREEN_STRIP_SENSITIVE_KEYS Comma separated list of keys to strip, refer to the dedicated section below for details strip_sensitive_keys Empty (use default values)
SQREEN_STRIP_SENSITIVE_REGEX Regular expression used for value stripping, refer to the dedicated section below for details strip_sentitive_regex Empty (use default values)

PII scrubbing

Unless you set strip_sensitive_data to false, Sqreen redacts certain data before sending information to Sqreen's servers. It redacts the values of key-value pairs listed in strip_sensitive_keys (compared in a case insensitive manner), and redacts any values, including array elements, but not keys, that fully match the strip_sensitive_regex configuration setting.

You can find default PII scrubbing values in PII Scrubbing.

Changing strip_sensitive_keys or strip_sensitive_regex overrides the defaults. You need to append your extra keys to the list of predefined keys and combine the default regular expression with your new one.