tzssangglass commented on issue #7454:
URL: https://github.com/apache/apisix/issues/7454#issuecomment-1185210621

   > I didn't catch your answer,can you please give me a more information or 
operation steps?
   
   We can add the following code to `clickhouse-logger` to register a custom 
variable:
   
   ```lua
   core.ctx.register_var("fmt_localtime", function(ctx)
       return ngx.localtime()
   end)
   ```
   
   Then use this variable in the metadata:
   
   ```
   curl http://127.0.0.1:9080/apisix/admin/plugin_metadata/clickhouse-logger -H 
'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "log_format": {
           "host": "$host",
           "@timestamp": "$fmt_localtime",
           "client_ip": "$remote_addr"
       }
   }'
   ```


-- 
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-unsubscr...@apisix.apache.org

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

Reply via email to