원클릭으로
eg-observability
Configure access logging, metrics, and distributed tracing for Envoy Gateway
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Configure access logging, metrics, and distributed tracing for Envoy Gateway
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | eg-observability |
| description | Configure access logging, metrics, and distributed tracing for Envoy Gateway |
| arguments | [{"name":"Feature","description":"Feature to configure: logging, metrics, tracing, all (default: all)","required":false}] |
Generate EnvoyProxy telemetry configuration for access logging, metrics, and distributed
tracing. Also covers Envoy Gateway controller logging and proxy debug logging. All
proxy-level telemetry is configured via the EnvoyProxy CRD under spec.telemetry.
The EnvoyProxy resource holds all telemetry configuration. It is linked to your
GatewayClass via parametersRef or to an individual Gateway via infrastructure.parametersRef.
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: observability-config # TODO: choose a descriptive name
namespace: envoy-gateway-system
spec:
telemetry:
# Sections below configure accessLog, metrics, and tracing.
# Include only the sections you need.
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
parametersRef:
group: gateway.envoyproxy.io
kind: EnvoyProxy
name: observability-config
namespace: envoy-gateway-system
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: eg
namespace: envoy-gateway-system
spec:
gatewayClassName: eg
infrastructure:
parametersRef:
group: gateway.envoyproxy.io
kind: EnvoyProxy
name: observability-config
listeners:
- name: http
protocol: HTTP
port: 80
Configure via spec.telemetry.accessLog. By default, Envoy Gateway sends a default
format to stdout. When you define custom settings, the default is replaced.
Reference: EGTM-016 recommends configuring access logging to detect unauthorized access and enable incident response.
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: observability-config
namespace: envoy-gateway-system
spec:
telemetry:
accessLog:
settings:
- format:
type: JSON
json:
start_time: "%START_TIME%"
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
protocol: "%PROTOCOL%"
response_code: "%RESPONSE_CODE%"
response_flags: "%RESPONSE_FLAGS%"
bytes_received: "%BYTES_RECEIVED%"
bytes_sent: "%BYTES_SENT%"
duration: "%DURATION%"
upstream_host: "%UPSTREAM_HOST%"
x_forwarded_for: "%REQ(X-FORWARDED-FOR)%"
user_agent: "%REQ(USER-AGENT)%"
request_id: "%REQ(X-REQUEST-ID)%"
authority: "%REQ(:AUTHORITY)%"
sinks:
- type: File
file:
path: /dev/stdout # TODO: change to a file path if not using stdout
spec:
telemetry:
accessLog:
settings:
- format:
type: Text
text: |
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"
sinks:
- type: File
file:
path: /dev/stdout
spec:
telemetry:
accessLog:
settings:
- format:
type: Text
text: |
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%"
sinks:
- type: OpenTelemetry
openTelemetry:
host: otel-collector.monitoring.svc.cluster.local # TODO: your OTel collector host
port: 4317 # TODO: your OTel collector gRPC port
resources:
k8s.cluster.name: "my-cluster" # TODO: set your cluster name
spec:
telemetry:
accessLog:
settings:
- sinks:
- type: ALS
als:
backendRefs:
- name: als-service # TODO: your ALS service name
namespace: monitoring # TODO: your ALS service namespace
port: 9000
type: HTTP # HTTP or TCP
Filter logs to reduce volume -- for example, only log errors or specific paths:
spec:
telemetry:
accessLog:
settings:
- format:
type: JSON
json:
method: "%REQ(:METHOD)%"
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
response_code: "%RESPONSE_CODE%"
duration: "%DURATION%"
# Only log requests that resulted in errors (4xx/5xx)
matches:
- "response.code >= 400"
sinks:
- type: File
file:
path: /dev/stdout
By default, access log settings apply to all Routes. You can separate Route-level and Listener-level logging:
spec:
telemetry:
accessLog:
settings:
- type: Route # Re-enable default access log for matched routes
- type: Listener # Custom log for listener-level events (e.g., TLS failures)
format:
type: Text
text: |
[%START_TIME%] %DOWNSTREAM_REMOTE_ADDRESS% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DOWNSTREAM_TRANSPORT_FAILURE_REASON%
sinks:
- type: File
file:
path: /dev/stdout
Configure via spec.telemetry.metrics. Prometheus metrics are enabled by default on
the Envoy admin port (19001) at /stats/prometheus.
To verify Prometheus is working:
# Port-forward to an Envoy proxy pod
kubectl port-forward -n envoy-gateway-system pod/<envoy-pod> 19001:19001
curl localhost:19001/stats/prometheus | head -50
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: observability-config
namespace: envoy-gateway-system
spec:
telemetry:
metrics:
prometheus:
disable: true
spec:
telemetry:
metrics:
sinks:
- type: OpenTelemetry
openTelemetry:
host: otel-collector.monitoring.svc.cluster.local # TODO: your OTel collector host
port: 4317 # TODO: your OTel collector gRPC port
spec:
telemetry:
metrics:
prometheus:
disable: false
# Enable virtual host stats for per-vhost metrics
enableVirtualHostStats: true
# Enable per-endpoint stats (use with caution -- high cardinality)
# enablePerEndpointStats: true
# Enable request/response size histograms
# enableRequestResponseSizesStats: true
sinks:
- type: OpenTelemetry
openTelemetry:
host: otel-collector.monitoring.svc.cluster.local
port: 4317
If you use the Prometheus Operator, create a PodMonitor to scrape Envoy proxy pods:
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: envoy-proxy-metrics
namespace: monitoring # TODO: your monitoring namespace
labels:
app.kubernetes.io/name: envoy-proxy
spec:
namespaceSelector:
matchNames:
- envoy-gateway-system # TODO: namespace where Envoy proxy pods run
selector:
matchLabels:
gateway.envoyproxy.io/owning-gateway-name: eg # TODO: your Gateway name
podMetricsEndpoints:
- port: metrics
path: /stats/prometheus
interval: 15s # TODO: adjust scrape interval
Key metrics to monitor:
envoy_http_downstream_rq_total -- total request countenvoy_http_downstream_rq_xx -- response code classes (2xx, 4xx, 5xx)envoy_cluster_upstream_rq_time -- upstream request latencyenvoy_http_downstream_cx_active -- active downstream connectionsenvoy_cluster_upstream_cx_active -- active upstream connectionsenvoy_cluster_membership_healthy -- healthy backend endpointsenvoy_cluster_upstream_rq_retry -- retry countConfigure via spec.telemetry.tracing. Envoy Gateway supports OpenTelemetry, Zipkin,
and Datadog as tracing providers.
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: observability-config
namespace: envoy-gateway-system
spec:
telemetry:
tracing:
# Sampling rate: percentage of requests to trace.
# Use 1-10 for production, 100 for staging/debugging.
samplingRate: 1 # TODO: adjust sampling rate (1-100)
provider:
type: OpenTelemetry
backendRefs:
- name: otel-collector # TODO: your OTel collector service name
namespace: monitoring # TODO: your OTel collector namespace
port: 4317 # gRPC port for OTLP
# Custom tags added to every span
customTags:
"k8s.cluster.name":
type: Literal
literal:
value: "my-cluster" # TODO: set your cluster name
"k8s.pod.name":
type: Environment
environment:
name: ENVOY_POD_NAME
defaultValue: "-"
"k8s.namespace.name":
type: Environment
environment:
name: ENVOY_POD_NAMESPACE
defaultValue: "envoy-gateway-system"
# Tag spans with a request header value
"x-request-source":
type: RequestHeader
requestHeader:
name: X-Request-Source
defaultValue: "unknown"
spec:
telemetry:
tracing:
samplingRate: 10
provider:
type: Zipkin
backendRefs:
- name: zipkin-collector # TODO: your Zipkin service name
namespace: monitoring
port: 9411
zipkin:
enable128BitTraceId: true
spec:
telemetry:
tracing:
samplingRate: 10
provider:
type: Datadog
backendRefs:
- name: datadog-agent # TODO: your Datadog agent service name
namespace: monitoring
port: 8126
Trace context propagation: Envoy automatically propagates W3C Trace Context
headers (traceparent, tracestate). Ensure your backend services also propagate
these headers to maintain end-to-end traces.
To configure logging for the Envoy Gateway control plane itself, update the EnvoyGateway configuration ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: envoy-gateway-config
namespace: envoy-gateway-system
data:
envoy-gateway.yaml: |
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyGateway
provider:
type: Kubernetes
gateway:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
logging:
level:
default: info # TODO: set to debug for troubleshooting
# Component-specific levels:
# gateway-api: debug
# provider: debug
# infrastructure: debug
# Control plane metrics
telemetry:
metrics:
prometheus:
disable: false
# Send control plane metrics to OTel collector:
# sinks:
# - type: OpenTelemetry
# openTelemetry:
# host: otel-collector.monitoring.svc.cluster.local
# port: 4317
# protocol: grpc
After updating the ConfigMap, restart the controller:
kubectl rollout restart deployment envoy-gateway -n envoy-gateway-system
To enable debug logging on specific Envoy Proxy components for troubleshooting, use the EnvoyProxy resource:
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: debug-proxy
namespace: envoy-gateway-system
spec:
logging:
level:
default: warn # Base level for all components
# Enable debug for specific components:
# http: debug
# router: debug
# connection: debug
# upstream: debug
You can also change log levels at runtime via the Envoy admin interface:
kubectl port-forward -n envoy-gateway-system pod/<envoy-pod> 19001:19001
# Set a component to debug level
curl -X POST "localhost:19001/logging?http=debug"
# Reset to warning
curl -X POST "localhost:19001/logging?http=warning"
parametersRef or Gateway infrastructure.parametersRefinfo in production, debug only for troubleshootingkubectl logs -n envoy-gateway-system -l gateway.envoyproxy.io/owning-gateway-name=egcurl localhost:19001/stats/prometheus via port-forwardConfigure client-facing traffic policies -- timeouts, connection limits, TLS settings, HTTP behavior
Production-grade Envoy Gateway setup with comprehensive security, observability, high availability, and operational best practices
Integrate Envoy Gateway with Istio ambient mesh or Cilium for unified ingress and service mesh
Envoy Gateway version information, compatibility matrix, and upgrade readiness checks
Envoy AI Gateway contribution orchestrator — interviews you about your contribution and guides you through the correct workflow using contributor skills
Envoy Gateway contribution orchestrator — interviews you about your contribution and guides you through the correct workflow using contributor skills