membphis commented on code in PR #13334:
URL: https://github.com/apache/apisix/pull/13334#discussion_r3198866741


##########
apisix/plugins/elasticsearch-logger.lua:
##########
@@ -200,11 +202,36 @@ local function get_es_major_version(uri, conf)
 end
 
 
-local function get_logger_entry(conf, ctx)
+local function resolve_index_vars(index, var)
+    local function replace_time(m)

Review Comment:
   To avoid temporary functions like `replace_time`
   
   ```lua
   local function replace_time(m)
    ... ...
   end
   
   local function resolve_index_vars(index, var)
    ... ...
    -- same as current
    local new_index, _, err = ngx_re.gsub(index, "(?<!\\$){([^}]*)}", 
replace_time, "jo")
       if not new_index then
           core.log.error("failed to substitute time format: ", err)
       end
     ... ...
   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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to