[how-to] Track a query from Retool AWS EC2 container logs

This is for self-hosted customers only and that the example is in the context of an AWS EC2 deployment

Query flow:

This tutorial tracks what happens to your query when clicking "Run" in your app:

  1. When viewing your application on the Frontend and you click 'Run' on a query, it travels to the Retool's backend wherever your Retool instance is hosted (i.e. EC2).
  2. This then tells your Retool instance to send the request to the api_container .
  3. The api_container will then send the request to db_connector container
  4. From here, the request is sent out to your query's endpoint to complete the request.
  5. Once the information is obtained from the API endpoint, the response of your query gets returned back to the db_connectorapi_container → back to you on the frontend within your app.

Example:

  1. Run your query from your Retool app

  2. SSH into your Retool instance containers

  3. cd into retool-onpremise-master

Inspecting your api_container:
4. Run sudo docker-compose logs --tail 10 api. This is telling docker to give me the logs of the last 10 container logs from the api container

Inspecting your DB-CONNECTOR container:
5. Run sudo docker-compose logs --tail 10 db-connector. This is telling docker to give me the logs of the last 10 container logs from the db-connector container

Extra Notes:

  • [Grab specific logs] You can run something like sudo docker-compose logs --tail 1000 | grep '<your_query_request_id>' with the query's requestId to grab the result:
    • sudo docker-compose logs --tail 1000 | grep '0fea6611-7479-4c33-a5e4-a4dff0c1e921'
  • [Axios] Retool is using node fetch/axios - failure of this library can be seen from DB_CONNECTOR
    • Example error:request to https://www.sdkfjhsjkfhsjhf.com/ failed, reason: getaddrinfo ENOTFOUND www.sdkfjhsjkfhsjhf.com. This is due to the library throwing an error because it couldn't reach the endpoint/find DNS for https://www.sdkfjhsjkfhsjhf.com
  • [DB_CONNECTOR returns Success] - DB_CONNECTOR can show a success, even if the query actually returned "fail" from the API endpoint