'Kong - Structured Json Logs
I can not find an example to output Kongs logs as JSONto system out. I am currently using Fluentd to ingest logs from my Kubernetes cluster but I have no idea how to send those logs to Fluentd as structured JSON.
Solution 1:[1]
For anyone who is struggling with this, I made the following updates to the kong helm chart values.
env:
admin_access_log: '/dev/stdout structured_logs'
proxy_access_log: '/dev/stdout structured_logs'
nginx_http_log_format: |
structured_logs escape=json '{"remote_addr": "$remote_addr", "remote_user": "$remote_user", "host": "$host"...}
Solution 2:[2]
Have you looked at the file-log plugin? https://docs.konghq.com/hub/kong-inc/file-log/
It lets you log to /dev/stdout and use lua to remove/add fields if necessary.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
| Solution 2 | esperluette |
