Forwarding Kong Gateway logs to New Relic provides valuable insights into API gateway performance, health, security, and usage. This document outlines how to direct the File Log plugin from Kong Gateway to forward logs from Kong Gateway to New Relic.
Compatibility and requirements
To use this log forwarding plugin, you need the following:
- Kubernetes plugin installed
- Kong Gateway installed with Custom Resource Definitions (CRDs)
Install the Kong Gateway plugin
To receive logs from Kong Gateway, you need to connect the Kong Gateway File Log plugin to the New Relic Kubernetes integration. This set-up directs the logs through a standard output (/dev/stdout
), which establishes a connection between the New Relic Kubernetes integration and Kong Gateway.
Install the New Relic Kubernetes logs integration
If you haven't already, install the New Relic Kubernetes plugin for log forwarding, then return to this doc. The plugin uses a standalone Docker image that collects and forwards logs from your Kubernetes environment.
Configure the File Log plugin
Once you've installed the Kong Gateway File Log plugin, you need to direct the plugin to send logs to /dev/stdout
. Here is an example manifest for this configuration:
# file-log-plugin.yamlapiVersion: configuration.konghq.com/v1kind: KongClusterPluginmetadata: name: global-file-log annotations: kubernetes.io/ingress.class: kong labels: global: "true"config: path: "/dev/stdout" # Directs logs through a standard output so New Relic can receive Kong Gateway logsplugin: file-log
Deploy the configuration to your Kubernetes cluster
Deploy the File Log plugin configuration to your Kubenrnetes cluster, but be sure to update file-log-plugin.yaml
with the actual filename of your manifest:
$kubectl apply -f file-log-plugin.yaml -n kong
Confirm that your logs are in the New Relic platform
Once you've deployed the configurations, go to one.newrelic.com > All Capabilities > Logs. Confirm that logs from Kong Gateway are appearing in the platform by triggering some data, then running a query that filters for that data.
You can start building that query with this example:
SELECT * FROM Log
What's next?
Now that you're forwarding your Kong Gateway logs to New Relic, we recommend checking out some of our other docs and tutorials:
- Follow our tutorial to learn how to manage a large log volume.
- Learn about our logs query syntax.
- Explore our docs about the logs UI, starting with our Logs UI overview doc