Kubeshark Filter Language 2 (KFL2) is the display filter system introduced in V2.00. It uses Common Expression Language (CEL) to provide powerful, flexible filtering of captured network traffic.
Display filters only affect what is shown in the dashboard. They do not impact which traffic is captured. For controlling what traffic is captured, see Capture Filters.
Using Display Filters
Enter your KFL2 filter expression in the filter input box at the top of the dashboard:
Building Filters with Click-to-Add
Every element visible in the dashboard has a green + button that can be clicked to automatically add filter expressions. This helps build complex filtering statements without typing.
Clicking the + button next to any value adds the corresponding filter expression (e.g., status_code == 200) to the filter input.
Once a filter is applied, only traffic matching the filter statement flows from the distributed Workers to the Hub to the Dashboard, reducing noise and focusing on relevant traffic.
Quick Examples
# HTTP GET requests with errorshttp && method == "GET" && status_code >= 400# Traffic to a specific namespacedst.pod.namespace == "production"# DNS queries for specific domainsdns && "google.com" in dns_questions# Large HTTP responseshttp && response_body_size > 10000
Supported Variables
Network-Level Variables
Variable
Type
Description
Example
src.ip
string
Source IP address
"192.168.1.1"
dst.ip
string
Destination IP address
"10.0.0.1"
src.port
int
Source port number
8080
dst.port
int
Destination port number
80
protocol
string
Detected protocol type
"HTTP", "DNS", "TCP"
Kubernetes Variables
Variable
Type
Description
Example
src.pod.name
string
Source pod name
"web-server-123"
dst.pod.name
string
Destination pod name
"database-456"
src.pod.namespace
string
Source pod namespace
"production"
dst.pod.namespace
string
Destination pod namespace
"default"
src.service.name
string
Source service name
"web-service"
dst.service.name
string
Destination service name
"db-service"
src.service.namespace
string
Source service namespace
"production"
dst.service.namespace
string
Destination service namespace
"default"
namespaces
list
All namespaces involved
["production", "default"]
pods
list
All pod names involved
["web-server-123", "db-456"]
services
list
All service names involved
["web-service", "db-service"]
node_name
string
Node name
"ks-node-001"
node_ip
string
Node IP address
"10.0.0.12"
Labels and Annotations
Variable
Type
Description
local_labels
map
K8s labels of the local peer
local_annotations
map
K8s annotations of the local peer
remote_labels
map
K8s labels of the remote peer
remote_annotations
map
K8s annotations of the remote peer
local_process_name
string
Process name on the local peer
remote_process_name
string
Process name on the remote peer
Protocol Detection
Use these boolean variables to filter by protocol:
Variable
Description
http
HTTP traffic
dns
DNS traffic
tls
TLS traffic
tcp
TCP traffic
udp
UDP traffic
ws
WebSocket traffic
redis
Redis traffic
kafka
Kafka traffic
ldap
LDAP traffic
amqp
AMQP traffic
radius
RADIUS traffic
diameter
Diameter traffic
sctp
SCTP traffic
icmp
ICMP traffic
HTTP Variables
Variable
Type
Description
url
string
Complete URL path
method
string
HTTP method (GET, POST, etc.)
status_code
int
Response status code
http_version
string
HTTP version
path
string
URL path component
query_string
map
URL query parameters
request.headers
map
Request headers
response.headers
map
Response headers
request.cookies
map
Request cookies
response.cookies
map
Response cookies
request_body_size
int
Request body size in bytes
response_body_size
int
Response body size in bytes
DNS Variables
Variable
Type
Description
dns_questions
list
DNS question names
dns_answers
list
DNS answer names
dns_request
bool
Is DNS request
dns_response
bool
Is DNS response
dns_question_types
list
DNS record types (A, AAAA, etc.)
TLS Variables
Variable
Type
Description
tls_summary
string
TLS handshake summary
tls_info
string
TLS connection details
tls_request_size
int
TLS request size in bytes
tls_response_size
int
TLS response size in bytes
Redis Variables
Variable
Type
Description
redis_type
string
Redis command verb (GET, SET, etc.)
redis_command
string
Full Redis command line
redis_key
string
The Redis key
redis_request_size
int
Request size in bytes
redis_response_size
int
Response size in bytes
Kafka Variables
Variable
Type
Description
kafka_api_key
int
Kafka API key number
kafka_client_id
string
Kafka client identifier
kafka_size
int
Message size
kafka_request
bool
Is Kafka request
kafka_response
bool
Is Kafka response
Timestamp Variables
Variable
Type
Description
timestamp
timestamp
Event time (UTC)
elapsed_time
int
Age since timestamp in microseconds
Filter Examples
Basic Network Filtering
# Filter by destination portdst.port == 80# Filter by IP address prefixsrc.ip.startsWith("192.168.")# Filter by multiple portsdst.port == 80 || dst.port == 443 || dst.port == 8080# Port rangedst.port >= 8000 && dst.port <= 9000
Kubernetes Filtering
# Traffic from a specific podsrc.pod.name == "web-server-123"# Traffic to a specific namespacedst.pod.namespace == "production"# Inter-service communicationsrc.service.name == "api-gateway" && dst.service.name == "user-service"# Traffic involving production namespace"production" in namespaces# Filter by pod labelslocal_labels.app == "payments" || remote_labels.app == "payments"# Filter by process namelocal_process_name == "nginx"
HTTP Filtering
# GET requestshttp && method == "GET"# API endpointshttp && url.contains("/api")# Client errors (4xx)http && status_code >= 400 && status_code < 500# Server errors (5xx)http && status_code >= 500# Specific header presenthttp && "authorization" in request.headers# Header value matchhttp && request.headers["content-type"] == "application/json"# URL pattern matchinghttp && url.matches(".*/api/v[0-9]+/.*")# Large responseshttp && response_body_size > 1000000
DNS Filtering
# DNS requests onlydns && dns_request# Specific domain queriesdns && "google.com" in dns_questions# DNS responses with answersdns && dns_response && size(dns_answers) > 0
Database Filtering
# Redis GET commandsredis && redis_type == "GET"# Redis key patternredis && redis_key.startsWith("session:")# Large Kafka messageskafka && kafka_size > 10000# Large Redis responsesredis && redis_response_size > 8192