Advanced Configuration in Python

Python agent configuration

You can configure the Sqreen Python agent with settings in a configuration file, or with environment variables. This page describes the configuration options available for the Python agent.

Configuration methods and precedence

The default method to configure the Sqreen Python agent is through the configuration file sqreen.ini in the config directory.

You can also configure most options with environment variables. Here are the order of precedence for configuration:

  1. Environment variables
  2. Configuration file sqreen.ini
  3. Default configuration options

Environment variables override the settings in the sqreen.ini configuration file. The configuration file settings override the agent default options.

Deploying Sqreen configuration

Configuration file should be deployed on the servers running Sqreen

Setting up the path of the configuration file

You can use a specific path for the configuration file using SQREEN_CONFIG_FILE environment variable:

export SQREEN_CONFIG_FILE=/custom/path/sqreen.ini 

Configuration variables

The Sqreen agent can be configured using environment variables or a sqreen.ini configuration file. Here are the settings that can be changed:

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_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

The Sqreen token is the only setting required.