Example Docker application for using Kong Plugin to log API analytics to Zenskar
To learn more about configuration options, please refer to Kong Plugin
- Start the docker container:
docker-compose -f docker-compose.yml up -d
- Configure the Zenskar plugin
curl --location 'http://localhost:8001/plugins' \
--data-urlencode 'name=zenskar' \
--data-urlencode 'config.api_endpoint=https://api.zenskar.com/usage/<raw_metric_slug>' \
--data-urlencode 'config.organisation_id=<organisation_id>' \
--data-urlencode 'config.customer_id_header=<customer_header>' \
--data-urlencode 'config.user_id_header=<user_id>' \
--data-urlencode 'config.authorization_key=<zenskar_token>'
Your Zenskar authorization_key and organisation_id can be found in the Zenskar Portal. customer_id and user_id headers are how you identify a customer and the user who called the api.
- Create a service
curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=example-zenskar-service' \
--data 'url=http://httpbin.org/uuid'
- Create a route
curl -i -X POST \
--url http://localhost:8001/services/example-zenskar-service/routes \
--data 'hosts[]=test.com'
- By default, The container is listening on port 80. You should now be able to make a request:
curl --location 'http://localhost:80/' \
--header 'Host: test.com' \
--header 'api_key: 8504c7eb-156c-4ea2-9512-a5ffe31dd47b' \
--header 'user_id: axis_bank'
- The data should be captured in the corresponding Zenskar Account Raw Metrics.
Congratulations! If everything was done correctly, Zenskar should now be tracking all network requests that match the route you specified earlier. If you have any issues with the setup, please reach out to [email protected].