You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "nic-6443 (via GitHub)" <gi...@apache.org> on 2026/05/06 13:41:16 UTC
[PR] feat(elasticsearch-logger): support dynamic index with time and variable resolution [apisix]
nic-6443 opened a new pull request, #13334:
URL: https://github.com/apache/apisix/pull/13334
The `field.index` configuration now supports dynamic patterns:
- Date/time patterns in curly brackets, e.g. `services-{%Y.%m.%d}`
- APISIX variables prefixed with \$, e.g. `services-$host`
- Both combined, e.g. `services-$host-{%Y.%m.%d}`
The index is resolved per-request without mutating the plugin configuration object, so it stays dynamic across requests (e.g. rotates correctly when the date changes).
This was previously documented in the attribute table but not actually implemented in the open-source codebase.
--
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: [PR] feat(elasticsearch-logger): support dynamic index with time and variable resolution [apisix]
Posted by "membphis (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(elasticsearch-logger): support dynamic index with time and variable resolution [apisix]
Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 commented on code in PR #13334:
URL: https://github.com/apache/apisix/pull/13334#discussion_r3198997372
##########
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:
Done, moved `replace_time` to module level.
--
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: [PR] feat(elasticsearch-logger): support dynamic index with time and variable resolution [apisix]
Posted by "nic-6443 (via GitHub)" <gi...@apache.org>.
nic-6443 merged PR #13334:
URL: https://github.com/apache/apisix/pull/13334
--
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