Custom device logs API v1 - POST filtered log content
Gets the filtered content of the specified log.
The log content can be retrieved using this call only when logAnalysisStatus equals READY
in the job status call.
The request consumes and produces an application/json
payload.
POST | Managed | https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/custom-devices/{customDeviceId}/logs/jobs/{jobId}/records |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/custom-devices/{customDeviceId}/logs/jobs/{jobId}/records | |
Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/custom-devices/{customDeviceId}/logs/jobs/{jobId}/records |
Authentication
To execute this request, you need an access token with Read logs (LogExport
) scope. To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
customDeviceId | string | The Dynatrace entity ID of the required custom device. | path | required |
jobId | string | The ID of the required log analysis job. You can retrieve it from the response of the POST analysis job request. | path | required |
scrollToken | string | The scrollToken value from the previous response. You can use it to get the next page of results. Without it, the first page is always returned. | query | optional |
pageSize | integer | The number of records per result page. If not set, each page contains 100 results. Maximum allowed value is | query | optional |
body | Filter | Filter the log content by the specified criteria. See Search patterns in log data and parse results in Dynatrace Documentation for the syntax definition and examples. | body | optional |
Request body objects
The FilterLogContent
object
A query to filter log content.
Element | Type | Description |
---|---|---|
filterQuery | string | The query for filtering. See Search patterns in log data and parse results in Dynatrace Documentation for the syntax definition and examples. Can be |
sortingAttributes | Sorting | How to sort the results. Can be |
The SortingAttributes
object
How to sort the results.
Element | Type | Description |
---|---|---|
sortAscending | boolean | Sort ascending ( Can be |
sortFieldName | string | The field to sort by. Can be |
Request body JSON model
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{
"filterQuery": "`testCustomField` = 4624",
"sortingAttributes": {
"sortAscending": "true",
"sortFieldName": "testCustomField"
}
}
Response
When scrolling through the result records using a scroll token, the last result page contains an empty records array and no scrollToken field.
Response codes
Code | Type | Description |
---|---|---|
200 | Log | Success |
400 | Error | Failed. See the response body for details |
Response body objects
The LogJobRecordsResult
object
The results of the log analysis job.
Element | Type | Description |
---|---|---|
records | Log | The list of log analysis results. The last page contains empty list. Can be |
scrollToken | string | The scroll token for the next page of results. Without it you'll get the first page again. Can be |
The LogRecord
object
The analysis result for a single log entry.
Element | Type | Description |
---|---|---|
timestamp | integer | The timestamp of the log entry, in UTC milliseconds. Can be |
logLevel | string | The severity level of the log entry. Can be |
hostId | string | The entity ID of the host that produced the log. Not applicable to OS logs. Can be |
text | string | The text of the log entry. Can be |
customFields | object | The map of the log entry custom fields. Can be |
Response body JSON model
{
"records": [
{
"timestamp": 1,
"logLevel": "string",
"hostId": "string",
"text": "string",
"customFields": {}
}
],
"scrollToken": "string"
}