Ready to get going? Start your 14 days free trial today

Start free trial

Have an account? Sign in

Send data via Kong to your Logstash instance provided by Logit.io

Kong

Ship logs from Kong to Logstash

Step 1 - Ensure Kong is Installed CorrectlyCopy

This guide recommends using the TCP Log Kong plugin. Please see the TCP Log Documentation for more detailed information.

Please ensure that you have Kong installed and at least one Kong service setup before continuing.

Instructions on how to install Kong, as well as how to setup a Kong service, can be found in the Kong Documentation.

Step 2 - InstallingCopy

You can either configure the TCP Log plugin to work with a Kong Service, Route or Consumer:

To configure the plugin to work on a Service, use:

curl -X POST http://kong:8001/services/{service}/plugins \
    --data "name=tcp-log"  \
    --data "config.host=your-logstash-host" \
    --data "config.port=your-ssl-port" \
    --data "config.tls=true"        

To configure the plugin to work on a Route, use:

curl -X POST http://kong:8001/routes/{route_id}/plugins \
    --data "name=tcp-log"  \
    --data "config.host=your-logstash-host" \
    --data "config.port=your-ssl-port" \
    --data "config.tls=true"        

To configure the plugin to work on a Consumer, use:

curl -X POST http://kong:8001/plugins \
    --data "name=tcp-log" \
    --data "consumer_id={consumer_id}"  \
    --data "config.host=your-logstash-host"" \
    --data "config.port=your-ssl-port" \
    --data "config.tls=true"            

Step 3 - Sending LogsCopy

You can test sending a log from Kong by sending a request to the service url:

curl --url http://kong:8000/ --header 'Host: example.com'

This will display a log in Kibana. You can use your Logit stack's Logstash filters to better structure incoming Kong logs.

Step 4 - Kong Logging OverviewCopy

Kong is an open source Lua app created on Nginx that is commonly used as an API gateway for microservices. The application is highly scalable & provides users with load balancing, authentication, and a variety of other useful functionality through the addition of plugins.

Kong is also known as an API middleware as it gives users a way to securely manage communication between clients and microservices. As well as being able to scale horizontally, Kong also benefits from being able to run across on premise, cloud & hybrid cloud environments.

The application generates a wide variety of logs with varying severities for further analysis & parsing including debug, info, warn, error, crit & general Kong access logs.

If we were to look at a few of the priority logging types we would want to focus on warning logs to spot any early issues we can get ahead of, error logs to observe at what rate they are being created & critical logs to discover why Kong may not be functioning as expected.

With all these log types it can be hard to know where to start to grasp a top level view of the overall health of your Kong services. Our Kong log analyser can centralise all of your Kong & any additional Nginx log data in a single platform for observability, reporting & reducing your mean time to resolution (MTTR).

Logit uses highly available tools including Logtstash, Kibana & Elasticsearch to help you make the most out of log analysis & container monitoring to make your business’s infrastructure fully scalable & ready for growth.

If you need any further help to analyse your Kong logs we're here to help. Feel free to reach out by contacting the Logit support team via live chat & we'll respond shortly.

Toggle View

Expand View

Return to Search