You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/04 01:51:31 UTC

[GitHub] [apisix] jagerzhang opened a new issue #5998: request help: logger plugins supports report custom labels of route

jagerzhang opened a new issue #5998:
URL: https://github.com/apache/apisix/issues/5998


   ### Issue description
   
   如图,为了方便管理,我们这边会给每个路由自定义系统和应用的标签。希望各日志插件能将这个标签也记录一下,方便在日志分析时和业务做快捷的对应。
   ![image](https://user-images.githubusercontent.com/9711651/147999031-159c6d34-5593-4395-b27f-96a368518d91.png)
   
   目前在用 kafka-logger ,望优先支持~~感谢。
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.11.0
   - OS (cmd: `uname -a`): docker-centos


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
jagerzhang commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017145182


   > #5941 just privode `register_var` function, not implemented in the logger plugin code?
   
   确实没有在日志插件中实现,我参考这个写法自己试了下,发现`ctx.matched_route.value`里面并没有labels相关内容,代码如下:
   ```
       local route = ctx.matched_route and ctx.matched_route.value
       core.log.info("route.value: ", core.json.delay_encode(route))  # 这里输出我看了下,里面是没有路由自定义标签的。
       if route and route.labels then
           entry.route = {}
           entry.route.labels = route.labels
       end
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang edited a comment on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
jagerzhang edited a comment on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017145182


   > #5941 just privode `register_var` function, not implemented in the logger plugin code?
   @tzssangglass @spacewander 
   确实没有在日志插件中实现,我参考这个写法,在`kafka-logger`试了下,发现`ctx.matched_route.value`里面并没有labels相关内容,代码如下:
   ```
       local route = ctx.matched_route and ctx.matched_route.value
       core.log.info("route.value: ", core.json.delay_encode(route))  # 这里输出我看了下,里面是没有路由自定义标签。
       if route and route.labels then
           entry.route = {}
           entry.route.labels = route.labels
       end
   ```
   
   输出内容:
   ![image](https://user-images.githubusercontent.com/9711651/150282118-b67b6c78-60f1-4184-a65a-4fb87812cc55.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang edited a comment on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
jagerzhang edited a comment on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017145182






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1004917457


   #5941 just privode `register_var` function, not implemented in the logger plugin code?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang edited a comment on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
jagerzhang edited a comment on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017145182


   > #5941 just privode `register_var` function, not implemented in the logger plugin code?
   @tzssangglass @spacewander 
   确实没有在日志插件中实现,我参考这个写法自己试了下,发现`ctx.matched_route.value`里面并没有labels相关内容,代码如下:
   ```
       local route = ctx.matched_route and ctx.matched_route.value
       core.log.info("route.value: ", core.json.delay_encode(route))  # 这里输出我看了下,里面是没有路由自定义标签的。
       if route and route.labels then
           entry.route = {}
           entry.route.labels = route.labels
       end
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1004527658


   Solved by https://github.com/apache/apisix/pull/5941


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017318313


   I demonstrate how to use it in https://github.com/apache/apisix/pull/6163


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] jagerzhang commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
jagerzhang commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1017420091


   > I demonstrate how to use it in #6163
   
   嗯,当我改造kafka-logger的时候,发现了一个bug,已提issue: https://github.com/apache/apisix/issues/6169


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #5998:
URL: https://github.com/apache/apisix/issues/5998#issuecomment-1004503630


   useful


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander closed issue #5998: request help: logger plugins supports report custom labels of route

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #5998:
URL: https://github.com/apache/apisix/issues/5998


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org