Example Docker application using Kong Plugin to log API calls to Moesif API analytics
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 Moesif plugin
curl -i -X POST --url http://localhost:8001/plugins/ --data "name=moesif" --data "config.application_id=YOUR_APPLICATION_ID";
Your Moesif Application Id can be found in the Moesif Portal. After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.
You can always find your Moesif Application Id at any time by logging into the Moesif Portal, click on the top right menu, and then clicking API Keys.
- Create a service
curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=example-moesif-service' \
--data 'url=http://httpbin.org/uuid'
- Create a route
curl -i -X POST \
--url http://localhost:8001/services/example-moesif-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 -i -X GET \
--url http://localhost:80/ \
--header 'Host: test.com'
- The data should be captured in the corresponding Moesif account.
Congratulations! If everything was done correctly, Moesif 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].
Remove all the routes and services
kong migrations reset -y
kong migrations bootstrap