How do I use "Custom Fields by Lua" for `file-log` plugin?

Hello, I’m using Kong Gateway OSS (2.3.x). I’d like to customize the contents logged by the file-log plugin.

I found the following on its docs page: “The custom_fields_by_lua configuration allows for the dynamic modification of log fields using Lua code.”

What I tried is the following based on the admin-api

curl -v \
  -X POST \
  --data 'name=file-log' \
  --data 'config.path=/tmp/file.log' \
  --data 'config.custom_fields_by_lua.route="return nil"' \
  http://localhost:8001/plugins

and I receive “schema violation (config.custom_fields_by_lua: unknown field)”. Does anyone know how to use custom_fields_by_lua? Thanks!

This feature is available in 2.4.x only.

So by reading source code, I figured it out too. And I could copy the plugin to the instance I’m running, it does work. I think I got confused by the file-log plugin page which says:

Version Compatibility:
KONG GATEWAY (ENTERPRISE)
 2.4.x
 2.3.x
 2.2.x
 2.1.x
 1.5.x
 1.3-x
 0.36-x
KONG GATEWAY (OSS)
 2.4.x
 2.3.x
 2.2.x
 2.1.x
 2.0.x
 1.5.x
 1.4.x
 1.3.x
 1.2.x
 1.1.x
 1.0.x
 0.14.x
 0.13.x
 0.12.x
 0.11.x
 0.10.x
 0.9.x
 0.8.x
 0.7.x
 0.6.x
 0.5.x
 0.4.x
 0.3.x

I just hope the documentation says a little more accurately. Maybe like, This plugin works with the following versions, but the latest added feature is only shipped from 2.4. or something.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ