0

How To Configure the Store and Forward Web API Log (version 24)

The following article explains how to configure the Canary system to create an API log that records all of the requests and responses from the Store and Forward Web API. This may be useful when troubleshooting API requests that are hitting the SaF service and offer insight as to how frequently API requests are coming in. It does NOT include the gRPC API.

Set Up

  1. Create a Profiling folder within %ProgramData%\Canary\Log.
  2. Place the attached SaFWebAPICallLog.config file within %ProgramData%\Canary\Log\Profiling.
  3. Restart the Store and Forward service.

As soon as an API request is made, a SaFWebAPICallLog.sqlite file will be created in the same directory. An application is needed to view this SQLite database (such as DB Browser). If such application is not available, Canary offers a portable version of DB Browser which is automatically installed with its software (C:\Program Files\Canary\Canary Utilities\SQLiteDatabaseBrowser64\DB Browser for SQLite.exe). Run this application, select Open Database, and browse for the above SQLite file.

 

 Select the Browse Data tab. The API log presents the following columns:

  • StartTime - unix time milliseconds
  • Session Token- token that is generated using the /getSessionToken request. Token will then be used for subsequent calls.
  • Function - the Canary API method being used. See writeapi.canarylabs.com for all of the available function.
  • RequestPreview - a preview of the request being made. If wishing to lengthen the preview, open the SaFWebAPICallLog.config file and increase the MaxRequestPreviewLength value. Value is number of characters.

  • RequestSizeBytes - the size of the request in bytes
  • Duration - the amount of time (milliseconds) it took to process the request
  • ResponsePreview - a preview of the response returned to the client. If wishing to lengthen the preview, open the SaFWebAPICallLog.config file and increase the MaxResponsePreviewLength value. Value is number of characters.

  • ResponseSizeBytes - the size of the response in bytes

The API log will hold up to 2 million requests. Once exceeded, the log will be trimmed down to 1.5 million. If wishing to disable the API log, edit the config file and set enabled = false.

Reply

null