Skip to main content
Version: 24.05

Filtering Rules

Enterprise

This feature is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Feature Metadata​

FieldValue
FeatureFiltering Rules
TypeIngestion-time request filtering
Public endpoint count5
Last updated2026-02-15

Overview​

Filtering Rules lets you block or filter incoming SDK data at app level.
Rules can target:

  • All requests (all)
  • Session data (session)
  • Event data (event)

Rules are stored on the app document and can be created, updated, enabled/disabled, listed, and deleted through API endpoints.

EndpointPath
Filtering Rules - Create/i/blocks/create
Filtering Rules - Update/i/blocks/update
Filtering Rules - Toggle Status/i/blocks/toggle_status
Filtering Rules - Delete/i/blocks/delete
Filtering Rules - List/o/blocks

Returned Data Fields​

The list endpoint returns an array of rule objects. Common fields:

FieldTypeDescription
_idStringRule ID
typeStringRule type: all, session, or event
keyStringTarget key (event key or *)
nameStringRule display/description text
ruleStringStringified rule definition
statusBooleanWhether rule is active
is_arbitrary_inputBooleanWhether event key is matched by input string behavior
_onReqBooleanRule can be evaluated early at request stage
last_triggeredNumberLast trigger Unix timestamp (seconds)

Configuration & Usage​

Rule Lifecycle​

  1. Create a rule (create).
  2. Validate behavior in incoming data.
  3. Enable/disable rule quickly (toggle_status).
  4. Update conditions (update) as needed.
  5. Remove obsolete rules (delete).

Rule Scope​

  • all: applies to request-level filtering.
  • session: removes session-related payloads when matched.
  • event: removes matching events (or specific event types) when matched.

Use Cases​

1. Block unwanted traffic patterns​

Block requests from known test devices, hosts, or IP patterns.

2. Exclude noisy session traffic​

Filter out session payloads from unwanted cohorts while keeping other data.

3. Exclude specific event streams​

Block noisy or non-production events by key or rule conditions.

4. Temporary rollout controls​

Disable problematic rules quickly without deleting configuration.

Limitations & Troubleshooting​

Limitations​

  • Rules are app-scoped and require app_id.
  • Rule definitions are passed as JSON string payload in blocks.
  • Duplicate rules (same type/key/name/rule) are rejected.

Common Issues​

Provide app_id

  • Include app_id in request.

Provide block object or Provide blocks update object

  • Ensure blocks parameter exists and contains valid JSON.

The rule already exists

  • Update existing rule instead of creating a duplicate.

No visible effect after change

  • Confirm rule status is enabled (status: true).
  • Verify rule scope (all / session / event) matches incoming payload type.
Implementation details

Database Collections

CollectionPurpose
countly.appsStores filtering rules in app blocks array
countly.blocked_users{appId}Stores temporary blocked-user data used in filtering flows