Docs Self-Managed Develop Consume Data Filter Messages Filter Messages with JavaScript in Redpanda Console Redpanda Console v3.x Redpanda Console v2.x Redpanda Console v3.x The Redpanda Operator deploys Redpanda Console v2.x, not v3.x. Redpanda Console v3 is not yet available when deploying with the Redpanda Operator. The Redpanda Operator continues to deploy Redpanda Console v2. To try Redpanda Console v3 in Kubernetes, you can deploy Redpanda using the Redpanda Helm chart instead of the Redpanda Operator. Redpanda Console configuration syntax varies by major version. Before configuring, determine which version you’re using: # Check console version from deployment kubectl get deployment -n <namespace> redpanda-console -o jsonpath='{.spec.template.spec.containers[0].image}' # Or check from running pod kubectl get pod -n <namespace> -l app.kubernetes.io/name=console -o jsonpath='{.items[0].spec.containers[0].image}' # Or check from console logs kubectl logs -n <namespace> -l app.kubernetes.io/name=console | grep "started Redpanda Console" If you see output like redpandadata/console:v2.8.0, you’re using Redpanda Console v2.x. If you see redpandadata/console:v3.0.0, you’re using Redpanda Console v3.x. You can use push-down filters in Redpanda Console to search through large Kafka topics that may contain millions of records. Filters are JavaScript functions executed on the backend, evaluating each record individually. Your function must return a boolean: true: record is included in the frontend results. false: record is skipped. Multiple filters combine logically with AND conditions. Add a JavaScript filter To add a JavaScript filter: Navigate to the topic’s Messages page. Click Add filter > JavaScript Filter. Define your JavaScript filtering logic in the provided input area. Resource usage and performance JavaScript filters are executed on the backend, consuming CPU and network resources. The performance of your filter depends on the complexity of your JavaScript code and the volume of data being processed. Complex JavaScript logic or large data volumes may increase CPU load and network usage. Available JavaScript properties Redpanda Console injects these properties into your JavaScript context: Property Description Type headers Record headers as key-value pairs (ArrayBuffers) Object key Decoded record key String keySchemaID Schema Registry ID for key (if present) Number partitionId Partition ID of the record Number offset Record offset within partition Number timestamp Timestamp as JavaScript Date object Date value Decoded record value Object/String valueSchemaID Schema Registry ID for value (if present) Number Values, keys, and headers are deserialized before being injected into your script. JavaScript filter examples Filter by header value Scenario: Records tagged with headers specifying customer plan type. Sample header data (string value) headers: { "plan_type": "premium" } JavaScript filter let headerValue = headers["plan_type"]; if (headerValue) { let stringValue = String.fromCharCode(...new Uint8Array(headerValue)); return stringValue === "premium"; } return false; Scenario: Records include a header with JSON-encoded customer metadata. Sample header data (JSON value) headers: { "customer": "{"orgID":"123-abc","name":"ACME Inc."}" } JavaScript filter let headerValue = headers["customer"]; if (headerValue) { let stringValue = String.fromCharCode(headerValue); let valueObj = JSON.parse(stringValue); return valueObj["orgID"] === "123-abc"; } return false; Filter by timestamp Scenario: Retrieve records from a promotional event. JavaScript filter return timestamp.getMonth() === 10 && timestamp.getDate() === 24; Filter by schema ID Scenario: Filter customer activity records based on Avro schema version. JavaScript filter return valueSchemaID === 204; Filter JSON record values Scenario: Filter transactions by customer ID. Sample JSON record { "transaction_id": "abc123", "customer_id": "cust789", "amount": 59.99 } JavaScript filter (top-level property) return value.customer_id === "cust789"; Scenario: Filter orders by item availability. Sample JSON record { "order_id": "ord456", "inventory": { "item_id": "itm001", "status": "in_stock" } } JavaScript filter (nested property) return value.inventory.status === "in_stock"; Scenario: Filter products missing price information. JavaScript filter (property absence) return !value.hasOwnProperty("price"); Filter string keys Scenario: Filter sensor data records by IoT device ID. JavaScript filter return key === "sensor-device-1234"; Back to top × Simple online edits For simple changes, such as fixing a typo, you can edit the content directly on GitHub. Edit on GitHub Or, open an issue to let us know about something that you want us to change. Open an issue Contribution guide For extensive content updates, or if you prefer to work locally, read our contribution guide . Was this helpful? thumb_up thumb_down group Ask in the community mail Share your feedback group_add Make a contribution 🎉 Thanks for your feedback! Follower Fetching Deserialize Messages