k8s nginx controller中日志切片配置
2021/7/23 7:11:42
本文主要是介绍k8s nginx controller中日志切片配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
只需要添加如下信息至configmap
apiVersion: v1 data: compute-full-forwarded-for: "true" enable-real-ip: "true" keep-alive-requests: "5000" log-format-upstream: '{"time": "$time_iso8601", "k8s_service_name":"$service_name", "remote_addr": "$proxy_protocol_addr", "x_forward_for": "$proxy_add_x_forwarded_for", "request_id": "$req_id", "remote_user": "$remote_user", "bytes_sent": $bytes_sent, "request_time": $request_time, "status": $status, "vhost": "$host", "request_proto": "$server_protocol", "path": "$uri", "request_query": "$args", "request_length": $request_length, "duration": $request_time,"method": "$request_method", "http_referrer": "$http_referer", "http_user_agent": "$http_user_agent" }' server-snippet: | if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})") { set $year $1; set $month $2; set $day $3; set $hour $4; set $minutes $5; set $seconds $6; } access_log /var/log/nginx/access_log_$ingress_name-$year-$month-$day-$hour.log upstreaminfo if=$loggable; upstream-keepalive-connections: "1000" use-forwarded-headers: "true" kind: ConfigMap metadata: annotations: meta.helm.sh/release-name: ingress-nginx meta.helm.sh/release-namespace: ingress-nginx creationTimestamp: "2021-04-08T10:09:29Z" labels: app.kubernetes.io/component: controller app.kubernetes.io/instance: ingress-nginx app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: ingress-nginx app.kubernetes.io/version: 0.44.0 helm.sh/chart: ingress-nginx-3.26.0 name: ingress-nginx-controller namespace: ingress-nginx resourceVersion: "6564521" selfLink: /api/v1/namespaces/ingress-nginx/configmaps/ingress-nginx-controller uid: 74f466c8-5d0e-4b27-bc96-e1a92d75113f
这篇关于k8s nginx controller中日志切片配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-05基于Kubernetes的自定义AWS云平台搭建指南
- 2024-11-05基于Kubernetes Gateway API的现代流量管理方案
- 2024-11-05在Kubernetes上部署你的第一个应用:Nginx服务器
- 2024-11-05利用拓扑感知路由控制Kubernetes中的流量
- 2024-11-05Kubernetes中的层次命名空间:更灵活的资源管理方案
- 2024-11-055分钟上手 Kubernetes:精简实用的 Kubectl 命令速查宝典!
- 2024-10-30K8s 容器的定向调度与亲和性
- 2024-10-28云原生周刊:K8s未来三大发展方向 丨2024.10.28
- 2024-10-25亚马逊弹性Kubernetes服务(EKS)实战:轻松搭建Kubernetes平台
- 2024-10-22KubeSphere 最佳实战:Kubernetes 部署集群模式 Nacos 实战指南