Monitoring
How to monitor the mirrord Operator with your existing logging, metrics, and tracing tools.
The mirrord Operator can produce logs in JSON format that can be digested by most popular logging solutions (DataDog, Dynatrace, etc). To enable JSON logging, set operator.jsonLog to true in the Operator Helm chart values. The log level is INFO by default, and can be changed by setting operator.logLevel in the Helm chart values, or alternatively by using the RUST_LOG environment variable in the Operator container, which takes values in the following format: mirrord={log_level} (e.g. mirrord=debug).
Functional Logs
The following logs are written with log level INFO, and can be used for dashboards within monitoring solutions in order to monitor mirrord usage within your organization:
Log messages:
Copy Target
Port Steal
Port Mirror
Port Release
Session Start
Session End
Message Processing
Session, port, and copy-target lifecycle logs use the following fields. Message Processing uses its own fields described below.
target
the session's target
All lifecycle events
client_hostname
whoami::hostname of client
All lifecycle events
client_name
whoami::realname of client
All lifecycle events
client_user
Kubernetes user of client (via k8s RBAC)
All lifecycle events
client_id
unique client id produced from client's certificate
All lifecycle events
client_cli_version
version of the client's mirrord CLI
All lifecycle events
session_id
unique id for individual mirrord sessions
Port Steal Port Mirror Port Release Session Start Session End
session_duration
the session's duration in seconds
Session End
port
port number
Port Steal Port Mirror Port Release
scale_down
whether the session's target was scaled down
Copy Target
Message Processing
The Operator emits a Message Processing log when mirrord handles an HTTP request or a message from a supported queue or message bus. These logs connect the mirrord session key with application correlation and tracing metadata, making it possible to investigate where an asynchronous flow stopped propagating trace context.
The logs are emitted automatically through the Operator's normal logging pipeline at level INFO. Set operator.jsonLog to true when your collector needs structured fields. In JSON output, the message processing values are nested under the top-level fields object, as shown in the abbreviated examples below. The same records can also be sent through the Operator's OpenTelemetry log exporter when its configured log level includes INFO.
All message processing records contain the following fields:
service_name
Name of the intercepted target workload
session_key
Correlation key of the mirrord session that handled the event
event_type
Kind of event: http, queue, or message_bus
mode
Routing mode: steal or mirror
event_timestamp
Time at which the Operator produced the event
HTTP
HTTP requests and responses are logged as two separate lifecycle records. The request record contains the intercepted request context:
method
HTTP request method
path
Request URI path
request_headers
Request header map, serialized as a JSON string. Values of headers that often hold secrets are redacted, see the note below. Not present when operator.hideHeadersAndProperties is true
correlation_id
Value of a recognized correlation ID header, when present
traceparent
W3C Trace Context traceparent header, when present
tracestate
W3C Trace Context tracestate header, when present
baggage
W3C baggage header, when present
For example:
When a stolen request completes, the Operator emits a separate response record containing response_status_code:
The response record does not currently contain a request identifier. When several requests are handled concurrently by one session, consumers should not assume that request and response records can be paired using their timestamps alone.
Queues and message buses
Queue and message bus records use the following fields when the broker provides the corresponding metadata:
queue_type
Broker type: sqs, azure_service_bus, bullmq, rmq, gcp_pubsub, kafka, redis_pubsub, nats, or nats_pubsub
queue_name
Queue, topic, subscription, or Redis channel name
message_id
Broker-provided message or job identifier
correlation_id
Broker-provided correlation ID or a recognized correlation ID property/header
message_properties
Message attributes, properties, or Kafka headers, serialized as a JSON string. Values of properties that often hold secrets are redacted, see the note below. Not present when operator.hideHeadersAndProperties is true
traceparent
W3C Trace Context value extracted from message properties or headers
tracestate
W3C Trace Context value extracted from message properties or headers
baggage
W3C baggage value extracted from message properties or headers
partition
Kafka partition
offset
Kafka offset
message_key
Kafka message key, when present
payload_size
Redis Pub/Sub payload size in bytes; the payload itself is not logged
For example, a queue message can produce:
Starting with mirrord Operator 3.215.0, the Operator writes [REDACTED] in place of the value of a header or message property when its name often holds a secret. The Operator uses only the ASCII letters and digits of the name, in lowercase, and the name matches when they contain one of these parts: accesskey, apikey, appcheck, auth, cookie, credential, csrf, encryptioncustomerkey, encryptionkey, functionskey, hmac, jwt, oidcdata, passphrase, passw, privatekey, pwd, secret, session, signature, subscriptionkey, token, or xsrf. For example, the values of Authorization, Cookie, X-Api-Key, api.key, Client-Secret and db_password are redacted. The name stays in the record, so you can still see which headers or properties a message had.
Querying the logs
You can inspect message processing records directly in the Operator's Kubernetes logs. The following commands assume that the Operator runs in the mirrord namespace.
Stream message processing records as they are emitted:
You can set operator.jsonLog to true (default setting) before using the jq examples so that each log line is valid JSON. Pipe the records through jq to make the JSON easier to read:
To follow records for one mirrord session, replace <your-session-key> with its session key:
Prometheus
The mirrord Operator can expose Prometheus metrics if enabled (the default endpoint is :9000/metrics).
Helm
Manual
OPERATOR_METRICS_ENABLED
enable metrics endpoint
"true" | "false"
"false"
OPERATOR_METRICS_ADDR
metrics http server addr
SocketAddr
"[::]:9000"
Exposed metrics
mirrord_license_valid_seconds
Seconds until license expiration
operator 3.101.0 (helm chart 1.15.0)
mirrord_sessions_create_total
Count of created sessions
client_hostname client_name client_user user_id
operator 3.101.0 (helm chart 1.15.0)
mirrord_sessions_duration
Histogram for finished sessions duration
client_hostname client_name client_user user_id
operator 3.101.0 (helm chart 1.15.0)
mirrord_ci_sessions_create_total
Count of created CI sessions
client_hostname client_name client_user user_id
operator 3.163.0
mirrord_ci_sessions_duration
Histogram for finished CI sessions duration
client_hostname client_name client_user user_id
operator 3.163.0
mirrord_operator_ping_latency
Histogram for round trip latency between the mirrord users and the Operator, helps identify infrastructure issues that may affect mirrord performance
client_hostname client_name client_user user_id
operator 3.122.0 (helm chart 1.35.0)
mirrord_stolen_connections_count
Count of stolen TCP connections
port namespace target user_id
operator 3.122.0 (helm chart 1.35.0)
mirrord_stolen_requests_count
Count of stolen HTTP requests
port namespace target user_id
operator 3.122.0 (helm chart 1.35.0)
mirrord_read_sqs_messages_count
Count of SQS messages read from original_queue
original_queue
operator 3.125.0 (helm chart 1.38.0)
mirrord_sqs_messages_forwarded_to_user_count
Count of SQS messages read from original_queue, forwarded to the local service of k8s_user, local_username.
k8s_user, local_username, original_queue
operator 3.125.0 (helm chart 1.38.0)
mirrord_unmatched_sqs_messages_count
Count of SQS messages read from original_queue that weren't matched by any user's filter and were sent to the main output queue for the deployed application.
original_queue
operator 3.125.0 (helm chart 1.38.0)
mirrord_previews_create_total
Count of created preview sessions
target_namespace target_kind target_name
operator 3.163.0
mirrord_previews_duration
Histogram for finished preview sessions duration
target_namespace target_kind target_name
operator 3.163.0
OpenTelemetry
OTEL logs and traces can be sent from the operator to a configured OTLP collector endpoint using an HTTP exporter.
Exporting Logs
To export logs from the operator to an endpoint, set operator.otelLogExportUrl to the URL in the Operator Helm chart values. You must set this value to export logs. This value does not affect the logs which are printed by the operator to stdout and are always enabled.
The log level is INFO by default, and can be changed by setting operator.otelLogLevel in the Helm chart values (or alternatively by using the OTEL_RUST_LOG environment variable in the Operator container), which takes values in the following format: mirrord={log_level} (e.g. mirrord=debug).
Note that this log level is separate to that defined for logs controlled by operator.logLevel, which are printed by the operator to stdout.
Exporting Traces
To export traces from the operator to an endpoint, set operator.otelTraceExportUrl to the URL in the Operator Helm chart values. You must set this value to export traces.
Using the downward API
As of version 3.186.0, entries in operator.extraEnv can take a full environment variable spec (valueFrom) instead of a plain string value. Any valid environment variable source works, not just the downward API: valueFrom with secretKeyRef or configMapKeyRef renders the same way. This means you can reference Kubernetes downward API values in operator.otel*ExportUrl variables, for example:
Context Propagation
You can use the mirrord.json file to propagate traceparent and baggage values to the Operator when running mirrord:
Note that it is expected that the trace ID value of traceparent is not hardcoded, but rather handled and passed in by some wrapper around mirrord. This is because duplicate trace IDs will lead to strange behaviour.
The Operator will propagate these values into exported spans for some frequently used actions, including creating a new resource. Other actions, especially those that result from Kubernetes resource reconciliation, will propagate these values in future versions.
For more info about using traceparent and baggage, see the OpenTelemetry docs about context propagation.
Pre-Built Dashboards
DataDog Dashboard
We offer a DataDog dashboard you can import to track statistics.
Download it here.
Grafana Dashboard
Alternatively there is a Grafana dashboard you can import to track statistics.
Download it here.
fluentd
If you are using fluentd you can add a filter to unpack some values from the "log" message:
This will expand all the extra fields stored in the "log" field.
fluentd + Elasticsearch
Assuming you are using logstash_format true and the connected mapping will store the extra fields in a keyword type, we have a ready made dashboard you can simply import.
Download it here (use Saved Objects to import).
Last updated
Was this helpful?

