Default logs in JSON



What is the best way to change the format of logs to json.
By default Kong as nginx_acc_logs and nginx_err_logs with a string format A - B - C - D.

the documentation is not very clear, can you help on this.


Solved, i´ve created a new custom-nginx.template with this:

http {
log_format json_combined escape=json
‘“status”: “$status”,’

access_log ${{PROXY_ACCESS_LOG}} json_combined;

include ‘nginx-kong-template.conf’;

and on start do kong start -c kong.yml --nginx-conf custom-nginx.template


Interesting! It can become a plugin :slight_smile:


Neat trick for those who want json output web server logs as opposed to the usual, nicely done.


It will more easy if we can put the log format pattern on global config.
I will do a pull request with this as soon as possible.


This only changes the format of access logs to json.
Did you find a way to also change the format of error logs to json?


is not supported by nginx change error logs