This guide will walk through two ways to retrieve all logs for a given installation of applications installed from the marketplace.
Method 1: Using the Cloud Scripting Console
Logs can be retrieved from the Cloud Scripting Console at https://app.$DOMAIN/console, where $DOMAIN is the platform domain. An account must be logged into the dashboard in order to view the logs on the console.
Below is an example of what the Cloud Scripting Console should look like with installation logs:
Method 2: Using the API
Logs can also be retrieved using API POST requests, however some information is required:
- Personal access token : Used to authenticate with the API, can be generated from the dashboard
- JPS scripting appid: Retrievable by using an API POST request
1. Generating a personal access token
On the dashboard, open the top right menu and click on Settings. In the User Settings pane, click on Access Tokens:
We can generate a new access token by clicking Generate:
A dialog will appear where you will be able to fill in the details of the access token such as its description, expiration date, and its functions:
In this case, we only need access to two API methods:
- marketplace.jps.getScriptingAppid
- io.file.Read
Fill in the required details and following the drop-down menus, tick the appropriate functions and then click Generate to generate the access token.
Note: While it is possible to select more functions, It is strongly recommended to limit what an access token can do, as they can potentially be destructive if used maliciously by unauthorized persons.
Another dialog will appear with the generated access token:
Keep this access token somewhere safe as this will be used in the next step.
2. Performing the POST requests
Using the marketplace.Jps-method-Install method you may define the name for the installation log and its path using the optional variables:
logsPath : "string" (optional)
loggerName : "string" (optional)
The curl command below is used to retrieve the scripting appid which will be used to retrieve the required installation logs.
Replace $DOMAIN with the platform domain name, and using the previously generated access token, replace $SESSION in with the access token.
$ curl --location --request POST 'https://app.$DOMAIN/1.0/marketplace/installation/rest/getscriptingappid' --data-urlencode 'session=$SESSION' --data-urlencode 'appid=cluster'
{"result":0,"appid":"$APPID"}
The output includes $APPID, which is the scripting appid.
Finally, we can use the following curl command to retrieve the logs. Similar to the previous command, replace $DOMAIN and $SESSION, and also replace $APPID with the scripting appid obtained from the previous output.
$ curl --location --request POST 'https://app.$DOMAIN/1.0/io/file/rest/read' --data-urlencode 'session=$SESSION' --data-urlencode 'appid=$APPID' --data-urlencode 'path=/cs.log'
{"result":0,"debug":{"cpu":{"usage":"0","time":33},"time":423},"body":...}
Below is an example of the outputs for the same installation logs: