From 22d9d69913b583f17334bd94a999baeb90fc0877 Mon Sep 17 00:00:00 2001 From: LordAbhishek Date: Mon, 17 Nov 2025 02:23:20 +0530 Subject: [PATCH 1/3] update consul-k8s cli proxy command docs --- .../content/docs/reference/cli/consul-k8s.mdx | 95 ++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx index d78e91203a..b34dd18345 100644 --- a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx +++ b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx @@ -335,7 +335,7 @@ $ consul-k8s install -set-string key=value-bool ### `proxy` -The `proxy` command exposes two subcommands for interacting with proxies managed by +The `proxy` command exposes four subcommands for interacting with proxies managed by Consul in your Kubernetes Cluster. - [`proxy list`](#proxy-list): List all Pods running proxies managed by Consul. @@ -734,6 +734,10 @@ $ consul-k8s proxy read backend-658b679b45-d5xlb -o raw The `proxy log` command allows you to inspect and modify the logging configuration of Envoy proxies running on a given Pod. +Command also allows you to capture logs of `control-dataplane` container of a Envoy Proxy Pod for a given duration, according to existing/new logging configurations and saves it to `proxy` folder in current working directory. +- If the `-update-level` flag is used, it temporarily applies new logging configurations, collects the logs, and then reverts log levels to the original settings. +- Otherwise, it captures logs using the existing log levels configuration. + ```shell-session $ consul-k8s proxy log ``` @@ -750,6 +754,7 @@ The following options are available. | `-namespace`, `-n` | `String` Specifies the namespace containing the target Pod. | Current [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) namespace. | | `-update-level`, `-u` | `String` Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for loggers: `-update-level `.

You can also specify a comma-delineated list to configure levels for specific loggers, for example: `-update-level grpc:warning,http:info`.

| none | | `-reset`, `-r` | `String` Reset the log levels for all loggers back to the default of `info` | `info` | +| `-capture` | `time.Duration` Capture the logs of `control-dataplane` of a Envoy Proxy Pod for a given duration, according to existing/new logging configurations and save it to proxy folder in current working directory. Saved filepath patten: `/proxy/.log` | 0 | #### Example commands In the following example, Consul returns the log levels for all of an Envoy proxy's loggers in a pod with the ID `server-697458b9f8-4vr29`: @@ -1015,6 +1020,94 @@ kafka info lua info ``` +The following commands capture the logs `control-dataplane` contaner of a envoy proxy pod for 10s at `existing logging configuration` and saves it to `current working directory` + +```shell-session +$ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s +Starting log capture... +Pod Name: backend-5cc8d59bb5-ndn5j +Container Name: consul-dataplane +Namespace: default +Log Capture Duration: 10s +Log File Path: proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log + ✓ Logs saved to 'proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log' + +$ cat proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log +2025-09-28T22:14:11.888675010Z 2025-09-28T22:14:11.887Z+00:00 [debug] envoy.http(31) [Tags: "ConnectionId":"108425"] new stream +2025-09-28T22:14:11.888895343Z 2025-09-28T22:14:11.888Z+00:00 [debug] envoy.http(31) [Tags: "ConnectionId":"108425","StreamId":"1388978360429204234"] request headers complete (end_stream=true): +2025-09-28T22:14:11.888911552Z ':authority', '10.244.0.58:20200' +2025-09-28T22:14:11.888917093Z ':path', '/metrics' +2025-09-28T22:14:11.888920635Z ':method', 'GET' +.... +2025-09-28T22:14:11.893417552Z +2025-09-28T22:14:11.893421927Z 2025-09-28T22:14:11.893Z+00:00 [debug] envoy.http(19) [Tags: "ConnectionId":"106890","StreamId":"3687233536774944639"] request headers complete (end_stream=true): +``` + +The following commands capture the logs `control-dataplane` contaner of a envoy proxy pod for a given duration at `new logging configuration` provided via `-update-level` flag and saves it to `current working directory` + +```shell-session +$ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s -update-level grpc:critical,http:warning,forward_proxy:trace,upstream:debug,rbac:error +Fetching existing log levels... +Setting new log levels... +Envoy log configuration for backend-5cc8d59bb5-ndn5j in namespace default: + +==> Log Levels for backend-5cc8d59bb5-ndn5j +Name Level +config warning +envoy_bug warning +forward_proxy trace +init warning +mongo warning +rds warning +runtime debug +hystrix warning +websocket warning +assert warning +...... +...... +stats warning +rbac error +admin warning +compression info +grpc critical +oauth2 warning +quic_stream warning +testing warning +udp warning +credential_injector info +ext_authz warning +jwt warning +pool warning +wasm warning +filter warning +geolocation info +http2 warning +kafka warning +dynamic_modules info +aws error +basic_auth info +health_checker warning +upstream debug +decompression warning + +Starting log capture... +Pod Name: backend-5cc8d59bb5-ndn5j +Container Name: consul-dataplane +Namespace: default +Log Capture Duration: 10s +Log File Path: proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log + ✓ Logs saved to 'proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log' +Resetting log levels back to existing levels... +Reset completed successfully! + +$ cat proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log +2025-09-28T22:30:30.800474005Z 2025-09-28T22:30:30.800Z [ERROR] consul-dataplane.dns-proxy.udp: error resolving consul request: error="rpc error: code = Unavailable desc = name resolver error: produced zero addresses" +2025-09-28T22:30:30.800545838Z 2025-09-28T22:30:30.800Z [ERROR] consul-dataplane.dns-proxy.udp: error resolving consul request: error="rpc error: code = Unavailable desc = name resolver error: produced zero addresses" +..... +2025-09-28T22:30:35.803969757Z 2025-09-28T22:30:35.803Z [INFO] consul-dataplane.server-connection-manager: connected to Consul server: address=10.244.0.110:8502 +2025-09-28T22:30:35.804500465Z 2025-09-28T22:30:35.804Z [INFO] consul-dataplane.server-connection-manager: updated known Consul servers from watch stream: addresses=[10.244.0.110:8502] +``` + ### `proxy stats` The `proxy stats` command allows you to inspect the Envoy cluster stats for Envoy proxies running on a given Pod. From f15430567468ef8430de27753997338d10776747 Mon Sep 17 00:00:00 2001 From: LordAbhishek Date: Mon, 17 Nov 2025 14:46:33 +0530 Subject: [PATCH 2/3] updated the docs --- .../content/docs/reference/cli/consul-k8s.mdx | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx index b34dd18345..8cb111d30d 100644 --- a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx +++ b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx @@ -734,9 +734,7 @@ $ consul-k8s proxy read backend-658b679b45-d5xlb -o raw The `proxy log` command allows you to inspect and modify the logging configuration of Envoy proxies running on a given Pod. -Command also allows you to capture logs of `control-dataplane` container of a Envoy Proxy Pod for a given duration, according to existing/new logging configurations and saves it to `proxy` folder in current working directory. -- If the `-update-level` flag is used, it temporarily applies new logging configurations, collects the logs, and then reverts log levels to the original settings. -- Otherwise, it captures logs using the existing log levels configuration. +Command also allows you to capture logs from the `control-dataplane` container of a Envoy proxy pod for the specified duration, according to existing/new logging configurations and saves them to the `proxy` folder in `current working directory`. ```shell-session $ consul-k8s proxy log @@ -749,12 +747,12 @@ the terminal displays configuration information for all proxies in the pod. The following options are available. -| Flag | Description | Default | -| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -| `-namespace`, `-n` | `String` Specifies the namespace containing the target Pod. | Current [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) namespace. | -| `-update-level`, `-u` | `String` Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for loggers: `-update-level `.

You can also specify a comma-delineated list to configure levels for specific loggers, for example: `-update-level grpc:warning,http:info`.

| none | -| `-reset`, `-r` | `String` Reset the log levels for all loggers back to the default of `info` | `info` | -| `-capture` | `time.Duration` Capture the logs of `control-dataplane` of a Envoy Proxy Pod for a given duration, according to existing/new logging configurations and save it to proxy folder in current working directory. Saved filepath patten: `/proxy/.log` | 0 | +| Flag | Description | Default | +| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `-namespace`, `-n` | `String` Specifies the namespace containing the target Pod. | Current [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) namespace. | +| `-update-level`, `-u` | `String` Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for loggers: `-update-level `.

You can also specify a comma-delineated list to configure levels for specific loggers, for example: `-update-level grpc:warning,http:info`.

| none | +| `-reset`, `-r` | `String` Reset the log levels for all loggers back to the default of `info` | `info` | +| `-capture` | `time.Duration` Captures logs from the `control-dataplane` container in the Envoy proxy pod for the specified duration, according to existing/new logging configurations and save them to the `proxy` folder in `current working directory`.

- If the `-update-level` flag is used, the command temporarily applies new logging configurations, captures logs, and then reverts/restore log levels to the original levels.

- Otherwise, it captures logs using the existing log levels configuration.

Saved filepath patten: `/proxy/.log`.

| 0s | #### Example commands In the following example, Consul returns the log levels for all of an Envoy proxy's loggers in a pod with the ID `server-697458b9f8-4vr29`: @@ -1020,7 +1018,7 @@ kafka info lua info ``` -The following commands capture the logs `control-dataplane` contaner of a envoy proxy pod for 10s at `existing logging configuration` and saves it to `current working directory` +The following commands capture the logs of `control-dataplane` container of a envoy proxy pod for `10s` at `existing logging configuration` and saves it to `proxy` folder in `current working directory` ```shell-session $ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s @@ -1043,7 +1041,7 @@ $ cat proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log 2025-09-28T22:14:11.893421927Z 2025-09-28T22:14:11.893Z+00:00 [debug] envoy.http(19) [Tags: "ConnectionId":"106890","StreamId":"3687233536774944639"] request headers complete (end_stream=true): ``` -The following commands capture the logs `control-dataplane` contaner of a envoy proxy pod for a given duration at `new logging configuration` provided via `-update-level` flag and saves it to `current working directory` +The following commands capture the logs of `control-dataplane` container of a envoy proxy pod for `10s` at `new logging configuration` provided via `-update-level` flag and saves it to `proxy` folder in `current working directory` ```shell-session $ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s -update-level grpc:critical,http:warning,forward_proxy:trace,upstream:debug,rbac:error @@ -1059,10 +1057,7 @@ forward_proxy trace init warning mongo warning rds warning -runtime debug -hystrix warning -websocket warning -assert warning +runtime debug ...... ...... stats warning @@ -1078,9 +1073,7 @@ credential_injector info ext_authz warning jwt warning pool warning -wasm warning -filter warning -geolocation info +wasm warning http2 warning kafka warning dynamic_modules info From 1052cd1ca6ffdc9927ee0f2ad00db86754b12087 Mon Sep 17 00:00:00 2001 From: LordAbhishek Date: Tue, 18 Nov 2025 14:10:37 +0530 Subject: [PATCH 3/3] Update suggested grammatical changes --- .../content/docs/reference/cli/consul-k8s.mdx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx index 8cb111d30d..19d14429a5 100644 --- a/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx +++ b/content/consul/v1.22.x/content/docs/reference/cli/consul-k8s.mdx @@ -734,7 +734,7 @@ $ consul-k8s proxy read backend-658b679b45-d5xlb -o raw The `proxy log` command allows you to inspect and modify the logging configuration of Envoy proxies running on a given Pod. -Command also allows you to capture logs from the `control-dataplane` container of a Envoy proxy pod for the specified duration, according to existing/new logging configurations and saves them to the `proxy` folder in `current working directory`. +This command also lets you capture logs from the `control-dataplane` container of an Envoy proxy pod for the specified duration, according to existing or new logging configurations, and saves them to the `proxy` folder in `current working directory`. ```shell-session $ consul-k8s proxy log @@ -750,9 +750,9 @@ The following options are available. | Flag | Description | Default | | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `-namespace`, `-n` | `String` Specifies the namespace containing the target Pod. | Current [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) namespace. | -| `-update-level`, `-u` | `String` Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for loggers: `-update-level `.

You can also specify a comma-delineated list to configure levels for specific loggers, for example: `-update-level grpc:warning,http:info`.

| none | +| `-update-level`, `-u` | `String` Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for all loggers: `-update-level `.

You can also specify a comma-delimited list to configure levels for specific loggers, such as `-update-level grpc:warning,http:info`.

| none | | `-reset`, `-r` | `String` Reset the log levels for all loggers back to the default of `info` | `info` | -| `-capture` | `time.Duration` Captures logs from the `control-dataplane` container in the Envoy proxy pod for the specified duration, according to existing/new logging configurations and save them to the `proxy` folder in `current working directory`.

- If the `-update-level` flag is used, the command temporarily applies new logging configurations, captures logs, and then reverts/restore log levels to the original levels.

- Otherwise, it captures logs using the existing log levels configuration.

Saved filepath patten: `/proxy/.log`.

| 0s | +| `-capture` | `time.Duration` Captures logs from the `control-dataplane` container inside the Envoy proxy pod for the specified duration, according to existing or new logging configurations, and saves them to the `proxy` folder in `current working directory`.

If you use the `-update-level` flag, the command temporarily applies new logging configurations, captures logs, and then reverts or restores log levels to the original levels. Otherwise, it captures logs using the existing log levels configuration.

Saved filepath patten: `/proxy/.log`.

| 0s | #### Example commands In the following example, Consul returns the log levels for all of an Envoy proxy's loggers in a pod with the ID `server-697458b9f8-4vr29`: @@ -1018,7 +1018,7 @@ kafka info lua info ``` -The following commands capture the logs of `control-dataplane` container of a envoy proxy pod for `10s` at `existing logging configuration` and saves it to `proxy` folder in `current working directory` +The following commands capture the logs of `control-dataplane` container of an Envoy proxy pod for `10s` at `existing logging configuration` and saves them to `proxy` folder in `current working directory`. ```shell-session $ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s @@ -1041,7 +1041,7 @@ $ cat proxy/proxy-log-backend-5cc8d59bb5-ndn5j.log 2025-09-28T22:14:11.893421927Z 2025-09-28T22:14:11.893Z+00:00 [debug] envoy.http(19) [Tags: "ConnectionId":"106890","StreamId":"3687233536774944639"] request headers complete (end_stream=true): ``` -The following commands capture the logs of `control-dataplane` container of a envoy proxy pod for `10s` at `new logging configuration` provided via `-update-level` flag and saves it to `proxy` folder in `current working directory` +The following commands capture the logs of `control-dataplane` container of an Envoy proxy pod for `10s` at `new logging configuration` provided via `-update-level` flag and saves them to the `proxy` folder in the `current working directory`. ```shell-session $ consul-k8s proxy log backend-5cc8d59bb5-ndn5j -capture 10s -update-level grpc:critical,http:warning,forward_proxy:trace,upstream:debug,rbac:error @@ -1065,9 +1065,6 @@ rbac error admin warning compression info grpc critical -oauth2 warning -quic_stream warning -testing warning udp warning credential_injector info ext_authz warning