当前位置:网站首页>在Istio中,到底怎么获取 Envoy 访问日志?
在Istio中,到底怎么获取 Envoy 访问日志?
2022-08-10 16:24:00 【InfoQ】
环境准备
httpbin
kubectl apply -f samples/httpbin/httpbin.yaml
sleep
kubectl apply -f samples/sleep/sleep.yaml
httpbin
sleep
kubectl -n istio-system edit configmap istio
data:
mesh: |-
accessLogEncoding: JSON
accessLogFile: /dev/stdout
accessLogEncoding
TEXT
JSON
TEXT
JSON
accessLogFile
测试访问日志
sleep
httpbin
export SLEEP_POD=$(kubectl get pods -l app=sleep -o 'jsonpath={.items[0].metadata.name}')
kubectl exec "$SLEEP_POD" -c sleep -- curl -sS http://httpbin:8000/headers
{
"headers": {
"Accept": "*/*",
"Host": "httpbin:8000",
"User-Agent": "curl/7.81.0-DEV",
"X-B3-Parentspanid": "ed0178f3e1f48dd1",
"X-B3-Sampled": "0",
"X-B3-Spanid": "6c38b689ee5ab0c8",
"X-B3-Traceid": "f17ce19c174cae85ed0178f3e1f48dd1",
"X-Envoy-Attempt-Count": "1",
"X-Forwarded-Client-Cert": "......"
}
}
sleep
kubectl logs -l app=sleep -c istio-proxy
sleep
httpbin
{
"authority": "httpbin:8000",
"bytes_received": 0,
"bytes_sent": 533,
"connection_termination_details": null,
"downstream_local_address": "172.24.146.239:8000",
"downstream_remote_address": "172.24.158.25:49350",
"duration": 3,
"method": "GET",
"path": "/headers",
"protocol": "HTTP/1.1",
"request_id": "ea40d320-348f-4f58-86d4-da157b0e0cca",
"requested_server_name": null,
"response_code": 200,
"response_code_details": "via_upstream",
"response_flags": "-",
"route_name": "default",
"start_time": "2022-07-04T10:00:09.401Z",
"upstream_cluster": "outbound|8000||httpbin.istio-demo.svc.cluster.local",
"upstream_host": "172.24.158.96:80",
"upstream_local_address": "172.24.158.25:41812",
"upstream_service_time": "2",
"upstream_transport_failure_reason": null,
"user_agent": "curl/7.81.0-DEV",
"x_forwarded_for": null
}
httpbin
kubectl logs -l app=httpbin -c istio-proxy
httpbin
sleep
{
"authority": "httpbin:8000",
"bytes_received": 0,
"bytes_sent": 533,
"connection_termination_details": null,
"downstream_local_address": "172.24.158.96:80",
"downstream_remote_address": "172.24.158.25:41812",
"duration": 2,
"method": "GET",
"path": "/headers",
"protocol": "HTTP/1.1",
"request_id": "ea40d320-348f-4f58-86d4-da157b0e0cca",
"requested_server_name": "outbound_.8000_._.httpbin.istio-demo.svc.cluster.local",
"response_code": 200,
"response_code_details": "via_upstream",
"response_flags": "-",
"route_name": "default",
"start_time": "2022-07-04T10:00:09.401Z",
"upstream_cluster": "inbound|80||",
"upstream_host": "172.24.158.96:80",
"upstream_local_address": "127.0.0.6:33665",
"upstream_service_time": "1",
"upstream_transport_failure_reason": null,
"user_agent": "curl/7.81.0-DEV",
"x_forwarded_for": null
}
刨析Envoy日志
清理
httpbin
sleep
kubectl delete -f samples/httpbin/httpbin.yaml
kubectl delete -f samples/sleep/sleep.yaml
边栏推荐
猜你喜欢
C language symbols on how to use
1001 A+B Format(字符串处理)
Annual salary of 600,000+?This 100,000-word interview assault book covers all technology stacks from Ali P5 engineers to P7
#夏日挑战赛#【ELT.ZIP】啃论文俱乐部——学术科研方法论沉淀辑
[FreeRTOS] 13 Dynamic Memory Management
如何修改gif尺寸?1分钟教你快速修改gif尺寸
如何将jpg静图做成gif动图?教你1分钟快速合成gif
8月Meetup | “数据调度+分析引擎”解锁企业数字化转型之路
从抖音到火山引擎——看流媒体技术演进和机会
【21天学习挑战赛】直接选择排序
随机推荐
FTXUI基础笔记(botton按钮组件进阶)
秘密共享方案介绍SS
LeetCode-692. Top K Frequent Words
商业智能BI行业分析思维框架:铅酸蓄电池行业(二)
v-for指令:根据数据生成列表结构
山西:一煤矿发生死亡1人安全事故 被责令停产整顿
找到一个超级神奇,百试百灵的解决 ModuleNotFoundError: No module named xxx 的方法
WIZnet 物联网设计大赛 - WizFi360大赛延迟通知
CDF 图的含义
直播预告|从新手村到魔王城,高效默契的敏捷团队如何炼成
babylonjs shader
1001 A+B Format(字符串处理)
险资又做LP,一出手40亿
被大厂面试官参考的Redis笔记,堪称Redis面试天花板
64位 RT-Thread 移植到 Cortex-A53 系统 bug 修复笔记
阿里工作7年,肝到P8就剩这份学习笔记了,已助朋友拿到10个Offer
数据治理项目成功的要点,企业培养数据要把握好关键环节
使用Jedis连接linux上的redis
如何使用Swift Package插件生成代码
清理空的 Jetpack Compose 应用程序模板