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-12-20/kubernetes 1.32版本更新解读:新特性和变化一目了然
- 2024-12-19拒绝 Helm? 如何在 K8s 上部署 KRaft 模式 Kafka 集群?
- 2024-12-16云原生周刊:Kubernetes v1.32 正式发布
- 2024-12-13Kubernetes上运行Minecraft:打造开发者平台的例子
- 2024-12-12深入 Kubernetes 的健康奥秘:探针(Probe)究竟有多强?
- 2024-12-10运维实战:K8s 上的 Doris 高可用集群最佳实践
- 2024-12-022024年最好用的十大Kubernetes工具
- 2024-12-02OPA守门人:Kubernetes集群策略编写指南
- 2024-11-26云原生周刊:K8s 严重漏洞
- 2024-11-15在Kubernetes (k8s) 中搭建三台 Nginx 服务器怎么实现?-icode9专业技术文章分享