Mastering Full Request and Response Logging on Amazon EKS
Full request and response compliance logging is essential for maintaining transparency and accountability in microservices architectures. It allows you to capture all aspects of HTTP interactions, which is vital for debugging, auditing, and regulatory compliance. By leveraging Envoy’s External Processing filter, you can log complete request and response data seamlessly, without touching your application code.
When an HTTP request enters your system, it follows a defined path. The client sends an HTTPS request, which is resolved by DNS to a Network Load Balancer (NLB) in your VPC. The NLB forwards this request to the Istio Ingress Gateway within your Amazon EKS cluster. The Ingress Gateway routes the traffic into the service mesh based on Gateway and Virtual Service resources. Once matched, the request hits the Envoy sidecar proxy, which is automatically injected into each pod by Istio. The Envoy sidecar then opens a bidirectional gRPC stream to the external processing service, a standalone Kubernetes Deployment running a gRPC server that implements the Envoy External Processing API. After the ext_proc server approves both the request and response phases, Envoy forwards the complete request to the application container, processes it, and returns the response. This entire interaction culminates in a single audit log entry, correlating all four phases—request headers, request body, response headers, and response body—using the x-request-id header.
In production, ensure you have the necessary tools installed, including AWS CLI, Terraform, and kubectl. The setup involves cloning a sample repository and initializing Terraform to manage your infrastructure. Be aware that you are working with an Amazon EKS 1.35 cluster in Auto Mode, which simplifies node provisioning and scaling. Pay attention to the integration of Envoy and Istio, as misconfigurations can lead to logging gaps or performance issues.
Key takeaways
- →Utilize Envoy’s External Processing filter to capture full request and response data without modifying application code.
- →Ensure your traffic flows through the Istio Ingress Gateway for proper routing and logging.
- →Correlate all four phases of logging using the x-request-id header for comprehensive audit trails.
- →Set up your environment with AWS CLI, Terraform, and other necessary tools before implementation.
- →Monitor your Amazon EKS cluster version to leverage the latest features and improvements.
Why it matters
In production, having complete visibility into request and response data can significantly enhance your ability to troubleshoot issues and ensure compliance with regulatory standards. This transparency is crucial for maintaining trust and accountability in microservices environments.
Code examples
git clone https://github.com/aws-samples/sample-full-request-response-logging-on-eks.git
cd sample-full-request-response-logging-on-ekscd terraform
tf initterraform apply -auto-approveWhen NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsUnified observability — logs, uptime monitoring, and on-call in one place. Used by 50,000+ engineering teams to ship faster and sleep better.
Try Better Stack free →Seamlessly Access Private Git Repositories in EKS with Argo CD
Unlock the power of Argo CD by integrating it with private Git repositories hosted on AWS. Learn how to set up AWS CodeConnections to create a secure network path for your Git server, ensuring smooth deployment workflows.
Mastering EKS Control Plane Egress: Route Your Traffic with Precision
Amazon EKS now allows you to route Kubernetes control plane traffic through your own VPC, giving you greater control over egress traffic. By enabling CUSTOMER_ROUTED mode, you can ensure that API server calls follow your configured routes and security groups.
Zero-Downtime Migration: From Ingress NGINX to Envoy Gateway
Migrating from Ingress NGINX to Envoy Gateway without downtime is crucial for maintaining service continuity. By leveraging weighted DNS records, you can run both systems simultaneously and control traffic flow seamlessly. This article breaks down the practical steps to achieve this migration effectively.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.