Setting up regular expressions

logfilter properties can be used to set up named sets of regular expressions for both server-side masking and client-side masking of sensitive data.

Each property is in the following form:


filterset.<name>.pattern.<num>=<pattern>
[optional]filterset.<name>.replace.<num>=<replace>

The pattern property is a Java-style regular expression, and defines the regular expression against which you want to match the message string. The replace property is optional, and defines the string which will be used to replace the expression. If the replace property is not defined, the default replacement string will be used. This property has no effect during a Filter. If the replacement string is invalid, the framework will catch the exception and print ***INVALID REPLACE VALUE***. The original unfiltered messages are not logged.

Sterling™ Order Management System Software provides the following properties that enable you to set the default FilterSet parameters for server-side masking:

  • default.filter.filterset=<filter_name>
  • default.layout.filterset=<layout_name>

You can also define a common set of patterns across multiple filter sets, for example:


filterset.<name>.includes=<name1>,<name2>,...
Note: You must set these logfilter properties in the customer_overrides.properties file, rather than editing them in logfilter.properties.in directly.

Sample configuration for log filter properties in <INSTALL_DIR>/properties/customer_ overrides.properties file

The following sample configuration creates two sets of regular expression patterns, suppress and common-filter, and associates them with the default Filter and Layout configurations:


#Setting default Filter and Layout configurations for server-side masking
logfilter.default.filter.filterset=suppress
logfilter.default.layout.filterset=common-filter

#The string “creditcardnumber” is suppressed in the log messages during 
#logging. (?i) indicates case-insensitive matching.

logfilter.filterset.suppress.pattern.2=Password\\s*\\=
#The string pattern “Password =” is suppressed in the log messages during
#logging.

logfilter.filterset.common-filter.pattern.1=(Password|CVV|CreditCardNo)\\s*=\\s*([“‘
]).*?\\2
#The string pattern “Password =” is replaced with the string pattern 
#mentioned in the replace property during logging.

logfilter.filterset.common-filter.replace.1=$1=****
#The string pattern “Password =” is replaced with the string pattern
#”Password=*******” during logging.

lofilter.filterset.suppress.includes=common-filter,<any_other_filter>

Notes:

  • An empty pattern will be ignored. The number at the end does not matter, but it must be unique.
  • If there is a loop in the dependencies, or if there is a preference to an invalid dependency, an exception is thrown. An exception is also thrown if a pattern is invalid. However, if the logfilter.properties file is missing, no exceptions are thrown, and nothing is filtered.