Getting the Logs of a Source With the API
Getting the Logs of a Source With the API
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, or delete content in a source.
You can use the Get indexing pipeline logs operation to retrieve the logs of one or more sources for a given time interval in a Coveo organization. You can also perform this action from the Coveo Administration Console.
This is a resource-intensive task that can take up to a minute to process, so you should avoid making frequent calls to the Source Logs API. |
Request template
POST https://api.cloud.coveo.com/logs/v1/organizations/<MY_ORGANIZATION_ID>?from=<FROM>&to=<TO> HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer <MY_ACCESS_TOKEN>
Payload
{
"sourcesIds": [
<MY_SOURCE_ID>
]
}
In the request path:
-
Replace
<MY_ORGANIZATION_ID>
with the ID of the target Coveo organization.
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.
Notes
|
In the Authorization
HTTP header:
-
Replace
<MY_ACCESS_TOKEN>
with an access token that grants the privileges to view organizations and sources (that is, the View access level on the Organizations domain and the View All access level on the Sources domain) in the target organization (see Create an API key, Get the privileges of an access token, Manage privileges, and Get your Coveo access token).
In the request body:
-
In the
sourcesIds
array, replace<MY_SOURCE_ID>
with the ID of the target source.NoteYou can include more than one value in the
sourcesIds
array if you want to retrieve indexing pipeline logs for multiple 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
}