You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "tehseensajjad-sys (via GitHub)" <gi...@apache.org> on 2025/02/27 15:01:01 UTC

[I] help request: log_labels for loki-logger donot accept any type of object. [apisix]

tehseensajjad-sys opened a new issue, #12005:
URL: https://github.com/apache/apisix/issues/12005

   ### Description
   
   Im trying to push all logs to our local loki instance.
   I want to add unique label for each route. But no form of log_label value works other than when the key is removed, the default `{job = "apisix"}` is added
   the error i get is
   ```
   unexpected status code 400; error message: {"error_msg":"failed to check the configuration of plugin loki-logger err: property \"log_labels\" validation failed: wrong type: expected object, got string"}
   ```
   
   Values i have tried
   ```
       plugins:                                                                                                                                                                                                                                                
       - config:                                                                                                                                                                                                                                               
           endpoint_addrs:                                                                                                                                                                                                                                     
           - example.com:3100                                                                                                                                                                                                                 
           include_req_body: true                                                                                                                                                                                                                              
           include_resp_body: true
           log_labels: '{environment = "dev"}'                                                                                                                                                                                                                             
         enable: true                                                                                                                                                                                                                                          
         name: loki-logger
   ```
   
   ```
   ...
           log_labels:
             environment: dev                                                                                                                                                                                                                          
   ...
   ```
   
   ```
   ...
           log_labels: {"environment": "dev"}                                                                                                                                                                                                                           
   ...
   ```
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.8.0
   - Operating system (run `uname -a`): BottleRocket Nodes (Kubernetes Deployment)
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): openresty/1.21.4.2
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): 3.5.7
   - Route deployment method: k8s crd, `apisix.apache.org/v2` `ApisixRoute`
   


-- 
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.apache.org

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


Re: [I] help request: log_labels for loki-logger donot accept any type of object. [apisix]

Posted by "tehseensajjad-sys (via GitHub)" <gi...@apache.org>.
tehseensajjad-sys closed issue #12005: help request: log_labels for loki-logger donot accept any type of object.
URL: https://github.com/apache/apisix/issues/12005


-- 
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


Re: [I] help request: log_labels for loki-logger donot accept any type of object. [apisix]

Posted by "tehseensajjad-sys (via GitHub)" <gi...@apache.org>.
tehseensajjad-sys commented on issue #12005:
URL: https://github.com/apache/apisix/issues/12005#issuecomment-2688275903

   Ok wow `'{environment:dev}'` worked. Maybe i need to learn lua


-- 
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