Host logs API v1 - POST top log content
Gets the 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 produces an application/json
payload.
POST | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs/jobs/{jobId}/records/top |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/{hostId}/logs/jobs/{jobId}/records/top | |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs/jobs/{jobId}/records/top |
Authentication
To execute this request, you need an access token with LogExport
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
hostId | string | The Dynatrace entity ID of the required host. | 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 |
body | FilterTopLogRecords | 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 FilterTopLogRecords
object
A query to filter top log records.
Element | Type | Description | Required |
---|---|---|---|
filterQuery | string | The query for filtering. See Search patterns in log data and parse results in Dynatrace Documentation page for syntax description. | optional |
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.
1{2 "filterQuery": "`testCustomField` = 4624"3}
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 | LogJobRecordsTopValuesRestResult | Success |
400 | ErrorEnvelope | Failed. See the response body for details |
Response body objects
The LogJobRecordsTopValuesRestResult
object
The top values results of the log analysis job.
Element | Type | Description |
---|---|---|
parsingFieldTopValues | ParsingFieldTopValue[] | Log analysis parsing result top values |
valuesCount | integer | Log analysis parsing result top values count |
The ParsingFieldTopValue
object
Element | Type | Description |
---|---|---|
fieldName | string | Top value parsing field name |
occurrences | Occurrence[] | Top value parsing field occurrences |
The Occurrence
object
Element | Type | Description |
---|---|---|
count | integer | Count of top parsing field occurrences |
value | string | Value of top parsing field occurrence |
Response body JSON model
1{2 "parsingFieldTopValues": [3 {4 "fieldName": ".Level",5 "occurrences": [6 {7 "count": "100",8 "value": "INFO"9 }10 ]11 }12 ],13 "valuesCount": 114}