- 4 minutes to read

ContextPropertiesFilters - System Parameter

The ContextPropertiesFilters System Parameter removes context properties from Log Events when their names match a regular expression (RegEx). Use it to keep sensitive data, such as passwords and keys, out of the Log Databases, and to save disk space. Context properties and the reserved Context Options keys are described with the Log Event.

An invoice Log Event with five Context Values, two of them named Contoso.Debug#, ContextPropertiesFilters opened from the System Parameters list and given one filter that removes names starting with Contoso.Debug#, saved, then a new invoice event stored with only three Context Values while the earlier event still has all five, animated walkthrough (7.12)
Animated walkthrough: one filter removes the Contoso.Debug# context properties. A new invoice event is stored without them, while the event logged before the change keeps all five. The Log API and the Logging Service were restarted off camera so the change applied at once.

  1. Open a Log Event's Context Values tab: five values, two of them named Contoso.Debug#....
  2. Filter the System Parameters list on ContextProperties and open ContextPropertiesFilters.
  3. Add one filter, ^Contoso\\.Debug#, that removes names starting with Contoso.Debug#. Save.
  4. Log a new invoice event: it's stored without the Contoso.Debug# values.
  5. Open the earlier event: it still has all five. Only new events are filtered.

At a Glance

Property Value
Key ContextPropertiesFilters
Data type json
Default null (no filtering)
Read by Log API and Logging Service
Takes effect Within about 15–20 minutes (the Log API keeps the filters 20 minutes, the Logging Service 15); restart both to apply a change at once
Status ✅ Active
Since Nodinite 6.0.0.11

How It Works

The Log API applies the filters to every event it receives, so matching data never enters Nodinite. The Logging Service applies them while it processes events from other sources, and when Log Events are re-indexed. In both places, each context property's name is compared with the enabled filters, and a property whose name matches is removed before it is stored. Events stored before a change keep their context properties.

Nothing is filtered when the value is null or when the global Enabled is false.

Important

Filtering permanently removes data; a removed context property can't be restored by a re-index. Test your expressions before you enable them in production.

Warning

Never remove http://schemas.microsoft.com/BizTalk/2003/system-properties#MessageExchangePattern. The Logging Service uses it to set the correct Event Direction for Log Events from BizTalk Server.

To hide a value but keep the context property, use ProtectedContextValues instead.

Value Format

The value is a JSON object with these properties:

Property Type Meaning
Enabled boolean Global switch. false turns all filtering off.
Filters array The filter entries.
Filters[].RegExFilter string Regular expression matched against the context property name. Case-insensitive; each expression may run for at most 1 second per context property. An expression that doesn't compile is skipped and logged; the others still apply.
Filters[].Description string Optional. Describes the intent of the entry.
Filters[].Enabled boolean Turns a single entry on or off, so you can keep an expression while you experiment.
{
  "Enabled": true,
  "Filters": [
    {
      "RegExFilter": "password",
      "Description": "Removes all context properties with password in the name (case-insensitive)",
      "Enabled": true
    },
    {
      "RegExFilter": "http://schemas.microsoft.com/BizTalk/2003/file-properties#SecretKey",
      "Description": "Removes the secret key used on dynamic send ports",
      "Enabled": true
    }
  ]
}

Example: remove every context property with "password" in its name, and the BizTalk Server secret key property.

Choosing a Value

  • Fewer, broader expressions perform better than many narrow ones; one RegEx can cover several property names.
  • Keep expressions simple so they finish well within the 1-second limit.
  • Use Filters[].Enabled to switch an entry off instead of deleting it.

Next Steps