Parameter Filtering
Basic parameter filtering in the AppSignal integrations works with a denylist, a list of keys to filter out and to not send. You can set a “filter parameters” option in the AppSignal configuration with a list of parameter keys to filter. Parameter values you’ve configured to filter out by will be replaced with a[FILTERED] value. This way, the list of parameters in the app data on AppSignal.com
still includes the parameter key but not the value, so you still have visibility that a value had potentially sensitive data filtered out before being sent to AppSignal.
Example
For example, an application with this AppSignal config:Ruby
The AppSignal for Ruby gem has two parameter filtering methods:- If your app uses Rails, you can use the Rails configuration directly.
- If your app uses another framework, like Sinatra or Padrino, you can use AppSignal’s built-in filtering instead.
AppSignal Parameter Filtering
Use the denylist for basic parameters filtering. This parameter filtering is applied to any query parameters in an HTTP request and any argument for background jobs. This filtering supports key based filtering for hashes, which will have their values replaced with[FILTERED]. There’s support for nested hashes and nested hashes in arrays. Any hash we encounter in your parameters will be filtered.
To use this filtering, add the following to your config/appsignal.yml file in the environment group you want it to apply. The filter_parameters value is an array of strings.
Rails Parameter Filtering
Luckily Rails provides a request parameter filtering mechanism to scrub data from log files. AppSignal leverages this request parameter mechanism so both your request logs and the request data sent to AppSignal are filtered by one configuration. Suppose the application should filter the same keys for request parameters and job arguments reported for different Ruby gems, like Sidekiq job arguments. In that case, it’s necessary to configure the parameter filtering in AppSignal using thefilter_parameters option to also include the keys set in the Rails config as it will not reuse the Rails parameter filtering configuration for those gems.
Denylist: Filtering Specific Keys
There are two ways to determine which keys get filtered. The first one is adding specific keys to the denylist. In the below example, the value of:secret in any post in the app will be replaced with [FILTERED].
accepts_nested_attributes_for. If we forget to explicitly add keys, they will not be filtered.
Allowlist: Allowing Specific Keys
Using a lambda instead of a list of keys gives more flexibility. In the following example, we use a lambda to set up an allowlist instead of a denylist.Elixir
If your app uses Phoenix, you can use the Phoenix parameter filtering. You can use AppSignal’s built-in filtering if your app uses a different Elixir framework.AppSignal parameter filtering
Use the denylist for basic parameters filtering. This parameter filtering is applied to any query parameters in an HTTP request. Set up parameter filtering using thefilter_parameters config option. The filter_parameters value is a List of Strings.
Phoenix filter_parameters Configuration
Use Phoenix’s parameter filtering to centralize your config, which is used to keep sensitive information from the logs. AppSignal will follow these filtering rules.filter_parameters config option is not set, Phoenix will default to ["password"] as a config. This means that a Phoenix app will not send any passwords to AppSignal without any configuration.
Node.js
Use thefilterParameters denylist for basic parameter filtering. This filtering is applied to all parameters of an HTTP request.
You can set up parameter filtering using the filterParameters config option. The filterParameters value is an array of strings.
Python
Use thefilter_parameters denylist for basic parameter filtering. This filtering is applied to all parameters of an HTTP request.
You can set up parameter filtering using the filter_parameters config option. The filter_parameters value is an array of strings.
Go
For Go, we report the request parameters as query parameters (?query=text) and payload data (POST request payload).
Use the filter_request_query_parameters denylist for request query parameter filtering. Set the send_request_query_parameters option to false to not send any request query parameters at all.
Use the filter_request_payload denylist for request payload data filtering. Set the send_request_payload option to false to not send any request payload data at all.
See the Go configuration page for more information on how to configure OpenTelemetry for Go apps.
Java
For Java, we report the request parameters as query parameters (?query=text) and payload data (POST request payload).
Use the filter_request_query_parameters denylist for request query parameter filtering. Set the send_request_query_parameters option to false to not send any request query parameters at all.
Use the filter_request_payload denylist for request payload data filtering. Set the send_request_payload option to false to not send any request payload data at all.
See the Java configuration page for more information on how to configure OpenTelemetry for Java apps.
PHP
For PHP, we report the request parameters as query parameters (?query=text) and payload data (POST request payload).
Use the filter_request_query_parameters denylist for request query parameter filtering. Set the send_request_query_parameters option to false to not send any request query parameters at all.
Use the filter_request_payload denylist for request payload data filtering. Set the send_request_payload option to false to not send any request payload data at all.
See the PHP configuration page for more information on how to configure AppSignal for PHP.