Traefik开启监控,日志,追踪需要的参数


监控

官方文档地址:https://doc.traefik.io/traefik/observability/metrics/overview/

可以使用多种监控软件,比如Datadog,InfluxDB,Prometheus,StatsD
在这里使用Prometheus

--api.debug=true
--metrics.prometheus=true
--metrics.prometheus.addEntryPointsLabels=true
--metrics.prometheus.addrouterslabels=true
--metrics.prometheus.addServicesLabels=true
--entryPoints.metrics.address=:8082
--metrics.prometheus.entryPoint=metrics
--metrics.prometheus.manualrouting=true

日志

官方文档地址:https://doc.traefik.io/traefik/observability/access-logs/

--accesslog=true
--accesslog.format=json # text
--log.filePath=/path/to/traefik.log #可以创建数据卷把这个路径给挂载出去
--log.level=DEBUG # DEBUG, PANIC, FATAL, ERROR, WARN, INFO
--accesslog.fields.defaultmode=keep
--accesslog.fields.names.ClientUsername=drop
--accesslog.fields.headers.defaultmode=keep
--accesslog.fields.headers.names.User-Agent=redact
--accesslog.fields.headers.names.Authorization=drop
--accesslog.fields.headers.names.Content-Type=keep

追踪

官方文档地址:https://doc.traefik.io/traefik/observability/tracing/elastic/

Traefik支持六个跟踪后端:Jaeger,Zipkin,Datadog,Instana,Haystack,Elastic

在这里是作为Elastic APM Agent来进行处理的,所以配置的是Elastic APM server相关参数

--tracing=true
--tracing.serviceName=traefik
--tracing.spanNameLimit=150
--tracing.elastic=true
--tracing.elastic.serverurl="http://apm:8200"
--tracing.elastic.secrettoken="mytoken"
--tracing.elastic.serviceenvironment="production"


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM