choey
choey

Reputation: 63

Filtering parameters by pattern

I want to filter certain params from the logs using this line found in the filter_parameter_logging.rb initializer:

config.filter_parameters += [:parameter_name]

The problem is the params I want to filter are variable, but do follow a certain pattern such as this:

example_param1 example_param2 example_param3 example_param4 etc.

How can I go about using config.filter_parameters to filter parameters by pattern, rather than explicit strings? Or how else might I accomplish this?

Upvotes: 1

Views: 1048

Answers (1)

PhilVarg
PhilVarg

Reputation: 4811

Parameters filter works by partial matching regular expression. You can add regular expressions to that array

config.filter_parameters += [/example_param\d+/]

Upvotes: 5

Related Questions