How to get CloudHub Application Logs in a Local File

Author: Manish Prabhu

There are some cloudhub APIs that can be used to retrieve the cloudhub application logs. These are the logs which we generally see inside the anypoint runtime manager. Following is the API which can be used to retrieve the application log & store it inside the file.

GET https://anypoint.mulesoft.com/cloudhub/api/v2/applications/{domain}/instances/{instance-id}/log-file

This API requires basic authentication as an authorization mechanism. It also requires X-ANYPNT-ENV-ID i.e. environment id in header.

Sample flow:

Using the HTTP Request, we will fetch the application logs. We will write those logs into a file using the File Write component. 

The above picture illustrates the snapshot of the file where the application logs are written. You can also verify this using the postman request. It will show the payload that is to be written inside the log file.

Instead of using the file write component, you can use the above API for getting the logs & can use the save response option in postman(any other tool like Advanced REST client) to save the response inside the file.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.