Access log to output plugin variables #13311
-
I have few metadata as variables in plugin that need to be outputted in kong's access log. What is the best way to share the variable between plugin and kong access log ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello @MUI-Pop, it is difficult to say what the best way is as that depends on your environment and deployment model. If you need to change the format of the If you have a little more freedom with respect to how your access log is written, you could use a custom plugin to write the access log in the format that you require. That plugin could then access Does this help? |
Beta Was this translation helpful? Give feedback.
-
Commented too early, looks like |
Beta Was this translation helpful? Give feedback.
Hello @MUI-Pop,
it is difficult to say what the best way is as that depends on your environment and deployment model. If you need to change the format of the
access_log
file which is written by nginx, then you'll need to work with a custom nginx configuration template, define the new variables and the access log format to use those variables, and then set the variables from your plugin inngx.ctx
. This approach is a little fiddly, however, in particular as you'll need to make sure that your custom templates keeps working across upgrades.If you have a little more freedom with respect to how your access log is written, you could use a custom plugin to write the access log in the format tha…