• Home
  • Dynatrace API
  • Environment
  • Log Monitoring v1
  • Hosts
  • POST top log content

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.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs/jobs/{jobId}/records/top
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/{hostId}/logs/jobs/{jobId}/records/top
Environment ActiveGatehttps://{your-activegate-domain}/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

ParameterTypeDescriptionInRequired
hostIdstring

The Dynatrace entity ID of the required host.

pathrequired
jobIdstring

The ID of the required log analysis job.

You can retrieve it from the response of the POST analysis job request.

pathrequired
bodyFilterTopLogRecords

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.

bodyoptional

Request body objects

The FilterTopLogRecords object

A query to filter top log records.

ElementTypeDescriptionRequired
filterQuerystring

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.

json
{ "filterQuery": "`testCustomField` = 4624" }

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

CodeTypeDescription
200LogJobRecordsTopValuesRestResult

Success

400ErrorEnvelope

Failed. See the response body for details

Response body objects

The LogJobRecordsTopValuesRestResult object

The top values results of the log analysis job.

ElementTypeDescription
parsingFieldTopValuesParsingFieldTopValue[]

Log analysis parsing result top values

valuesCountinteger

Log analysis parsing result top values count

The ParsingFieldTopValue object

ElementTypeDescription
fieldNamestring

Top value parsing field name

occurrencesOccurrence[]

Top value parsing field occurrences

The Occurrence object

ElementTypeDescription
valuestring

Value of top parsing field occurrence

countinteger

Count of top parsing field occurrences

Response body JSON model

json
{ "parsingFieldTopValues": [ { "fieldName": ".Level", "occurrences": [ { "value": "INFO", "count": "100" } ] } ], "valuesCount": 1 }
Related topics
  • Log Monitoring Classic

    Learn how to enable Log Monitoring, the insights that Log Monitoring can provide, and more.