-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugins) add log by lua capability #6944
Conversation
ef84f1e
to
634eedd
Compare
5be62ec
to
4a4982b
Compare
4a4982b
to
5d96f3d
Compare
@@ -69,6 +73,12 @@ local FileLogHandler = { | |||
|
|||
|
|||
function FileLogHandler:log(conf) | |||
if conf.custom_fields_by_lua then | |||
for key, expression in pairs(conf.custom_fields_by_lua) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight concern on this usage of pairs
inside a hot path. It can not be JIT compiled by LuaJIT and may result in slow execution. Any chance pairs
can be avoided here?
It's not a blocker for the PR, but just making a note here so we remember to look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into this after the beta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the pairs
loop goes around a sandbox(expression, ...)
; i don't think it could be considered a tight loop.
tangentially related: pairs()
isn't an NYI because it's too complex, but because the interpreted version is faster in most cases. the downside is that it breaks surrounding traces, which is bad if there's tight code with high interpretation penalty (like FFI). for "wide" loops it's ok, the result will be a few more chained sidetraces.
038480e
to
5d96f3d
Compare
Add capability to set new fields, or unset existing fields, by executing custom Lua code. This feature uses the new PDK method `kong.log.set_serialize_value`, introduced in Kong 2.3.
41e0fa9
to
a17256a
Compare
Add capability to set new log fields, or unset existing fields, by
executing custom Lua code in the Log phase.
This feature uses the new PDK method
kong.log.set_serialize_value
,as well as the new sandbox capability, both introduced in Kong 2.3.
Currently supported logging plugins:
Not included in: