Getting the Logs of a Source With the API

In this article

Sometimes, you may want to retrieve the detailed Coveo indexing pipeline logs of a specific source. These logs can be especially useful when you need to assert that items are being processed as expected when using the Push API to add, update and/or delete content in a source.

You can use the Get specified source document logs operation to get the logs of a given source in a Coveo organization.

Retrieving the detailed logs of a source using the Source Logs API is a resource-intensive task that can take up to a minute to process.

Therefore, you should avoid making Source Logs API calls at a high frequency.

You can also perform this action from the Coveo Administration Console (see Inspect Indexing Logs).

Request template

POST https://api.cloud.coveo.com/logs/v1/organizations/<MyOrganizationId>?from=<from>&to=<to> HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer <MyAccessToken>

Payload

{
  "sourcesIds": [
    <MySourceId>*
  ]
}

In the request path:

In the query string:

  • Replace <from> with the date and time corresponding to the beginning of the range for which to retrieve source logs.
  • Replace <to> with the date and time corresponding to the end of the range for which to retrieve source logs.

    The <from> and <to> values must be in the standard W3C date and time format (e.g., 2017-10-09T19:57:09.714Z).

    See Date and Time Formats.

In the Authorization HTTP header:

In the request body:

  • In the sourcesIds array, replace the <MySourceId>* with the actual ID of the target source.

    You can include more than one value in the sourcesIds array if you want to retrieve indexing pipeline logs for many sources.

The body of a successful response (200 OK) contains detailed indexing pipeline logs in the specified time range for the target source.

Sample Request

Retrieving the indexing pipeline logs of a single source

POST https://api.cloud.coveo.com/logs/v1/organizations/mycoveocloudv2organizationg8tp8wu3?from=2017-11-21T15:23:36.887Z&to=2017-11-21T16:23:36.887Z HTTP/1.1
 
Content-Type: application/json
Accept: application/json
Authorization: Bearer **********-****-****-****-************

Payload

{
  "sourcesIds": [
    "mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy"
  ]
}

Successful response - 200 OK

 {
  "documentLogEntries": [
    {
      "id": "http://www.example.com/",
      "organizationId": "mycoveocloudv2organizationg8tp8wu3",
      "sourceId": "mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy",
      "task": "CONSUMING",
      "operation": "ADD",
      "result": "ERROR",
      "datetime": "2017-11-21T15:55:36.887Z",
      "meta": {
        "errorMessage": "The document message with id '44d26e58-8b0e-40b5-a571-95c2e7b114b2' is invalid. Cause: com.coveo.cloud.pushapi.exceptions.InvalidPermissionsException: No permissions are set on document.",
        "errorCode": "INVALID_DOCUMENT"
      }
    },
    {
      "id": "http://www.example.com/",
      "organizationId": "mycoveocloudv2organizationg8tp8wu3",
      "sourceId": "mycoveocloudv2organizationg8tp8wu3-rp5rxzbdz753uhndklv2ztkfgy",
      "task": "STREAMING",
      "operation": "ADD",
      "result": "COMPLETED",
      "datetime": "2017-11-21T15:59:12.887Z"
    }
  ],
  "hasNextPage": false
}
What's next for me?