-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support to log custom labels of route by default #6181
Conversation
We already provide a mechanism to do it: #6163 |
This PR is to log some data without changing the file format. Is it different? |
I will reopen this PR for more discussions |
@moonming 感谢回复。
日志格式有两种定义方式: 自定义日志格式这个模式,需要用户自定义log_format。我觉得这个场景有2个难点:
比如space小哥这里提的优化:#6163 支持用户自定义日志格式,也能够记录路由里面 总体来说,这种方式的上手门槛和运维成本较高,所以我们没有选择这个方式。 默认的全日志格式这个模式,不需要用户自定义日志就能得到非常全面的日志格式(通过 最后,我说下我们为什么需要这个自定义标签前面我也提交了相关issue: #5998 我们是想通过在路由里面定义标签,实现和生产业务的关联关系,这样做的好处很多,比如后续网关用户可以在网关服务门户能快速提取具体路由对应的请求日志,而不需要到日志里面去进行复杂的索引(我们目前正在将APISIX包装成一站式的七层接入服务),再比如可以快速聚合分析各业务、应用的请求流量,更准确的将告警送达到具体业务等等,而不需要通过复杂的域名和路由组合条件来关联到具体业务。 以上就是我这边的一些理解和说明,如果讲得不对请指正。 如果最终确实觉得路由自定义标签不适合默认就添加到全日志当中,能否考虑一下以下实现方式: 如果都觉得不合理,那我们只能单独维护 |
It is very unsuitable to add every field to the default log format. And there is no need to maintain your own kafka-logger. Your understanding of APISIX is very very incorrect.
Please read the code carefully. All labels are logged.
Solved. Use a custom variable to call the
The current way is to avoid putting any more fields into the full log. Every new field should be in the custom log. |
@spacewander https://github.com/apache/apisix/pull/5941/files 求问下,我看到这个特性需要自己写代码注册自定义变量:
那这个代码是写到哪里呢? 我只是一个普通APISIX用户,并不是开发..确实没看出来应该怎么将这个路由labels记录到kafka-logger里面。 |
What this PR does / why we need it:
supports to log custom labels of route when the log_format not defined(Code reference tapisix by @kyroslin): #5998