Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.55 KB

README.md

File metadata and controls

35 lines (24 loc) · 1.55 KB

OpenResty with Moesif API Logging Example

Example Docker application using Moesif OpenResty plugin to log API calls to Moesif API analytics

To learn more about configuration options, please refer to Moesif OpenResty plugin.

How to run this example

  1. Clone this repo and edit the nginx.conf.d/main.conf file to set your actual Moesif 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.

  1. Build the docker image
docker buildx build --platform linux/amd64 -t openresty-docker-demo ./
  1. Start the docker container:
docker-compose up -d

By default, The container is listening on port 8000. You should now be able to make a request:

curl -X POST -H "Content-Type: application/json" -d '{"name":"moesif"}' "http://localhost:8000/api?x=2&y=4" -H 'User-Id:123' -H "Company-Id:567"
  1. 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 set up, please reach out to [email protected].