Export Logs

For a given environment associated with an account, you can retrieve logs through an http request.

 

How to enable log export

From the admin console, select an environment and choose Applications.

Create a new application that has:

  • logging enabled
  • uses oauth2 security

If you currently have an application with these two conditions, you may use it.
Depending on how you manage the secret, you may want a specific application for this purpose.

The Client ID for the application will be the username.
The Client Secret will be the password.

 

How to export logs with cURL

The general process is to use the clientId/clientSecret to request an oauth2 bearer token and then use that token to request the logs.

Using cURL as an example:

curl -X POST https://interopio.com/auth/token?grant_type=client_credentials&expires_in=1000 -H 'Accept: application/json' -H 'Content-Type: application/x-www-form-urlencoded' --user clientId:clientSecret

This should generate you a token you can use for an hour.

Once you have the token you can now make a cURL call to the logging endpoint where ACCOUNT is your account and ENVIRONMENT is, well, the environment.

The start time param is required and should be an epoch timestamp:

curl -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" https://interopio.com/logging/export/<ACCOUNT>/<ENVIROMENT>?startTime=1608627600000

You have the following query parameters you can use to tune the request:

  • startTime an epoch timestamp in milliseconds
  • endTime an epoch timestamp in milliseconds should be after startTime
  • gatewayId an ID to filter on
  • pageIndex a page index to start on when paging
  • pageSize how big each page is

The prams are case sensitive.

You should receive a json payload with each log record:

{
"_embedded": {
"appsLogsDtoes": [
.... each log record
]
},
"_links": {
"self": {
"href": "http://interopio.com/logging/export/ACCOUNT/ENV?startTime=1608627600000&endTime=1608714000000&page=0&size=1000"
}
},
"page": {
"size": 1000,
"totalElements": 125,
"totalPages": 1,
"number": 0
}
}


 

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.