Process group logs API v1 - POST filtered log content

deprecated

This API is deprecated.

  • For Log monitoring - Custom devices, Hosts, or Process Groups, what to use instead depends on which version of Log Monitoring you use:
  • For Calculated metrics - Log Monitoring, use the Settings API endpoint with schemaId builtin:logmonitoring.schemaless-log-metric.

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.

POSTSaaShttps://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/{pgId}/logs/jobs/{jobId}/records
Environment ActiveGatehttps://{your-activegate-domain}:9999/e/{your-environment-id}/api/v1/entity/infrastructure/process-groups/{pgId}/logs/jobs/{jobId}/records

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
pgIdstring

The Dynatrace entity ID of the required process group.

pathrequired
jobIdstring

The ID of the required log analysis job.

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

pathrequired
scrollTokenstring

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.

queryoptional
pageSizeinteger

The number of records per result page.

If not set, each page contains 100 results.

Maximum allowed value is 10000.

queryoptional
bodyFilterLogContent

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 FilterLogContent object

A query to filter log content.

ElementTypeDescriptionRequired
filterQuerystring

The query for filtering.

See Search patterns in log data and parse results in Dynatrace Documentation for the syntax definition and examples.

optional
sortingAttributesSortingAttributes

How to sort the results.

optional

The SortingAttributes object

How to sort the results.

ElementTypeDescriptionRequired
sortAscendingboolean

Sort ascending (true) or descending (false).

optional
sortFieldNamestring

The field to sort by.

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.

{
"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

CodeTypeDescription
200LogJobRecordsResult

Success

400ErrorEnvelope

Failed. See the response body for details

4XXErrorEnvelope

Client side error.

5XXErrorEnvelope

Server side error.

Response body objects

The LogJobRecordsResult object

The results of the log analysis job.

ElementTypeDescription
recordsLogRecord[]

The list of log analysis results.

The last page contains empty list.

scrollTokenstring

The scroll token for the next page of results.

Without it you'll get the first page again.

The LogRecord object

The analysis result for a single log entry.

ElementTypeDescription
customFieldsobject

The map of the log entry custom fields.

hostIdstring

The entity ID of the host that produced the log.

Not applicable to OS logs.

logLevelstring

The severity level of the log entry.

textstring

The text of the log entry.

timestampinteger

The timestamp of the log entry, in UTC milliseconds.

Response body JSON model

{
"records": [
{
"customFields": {},
"hostId": "string",
"logLevel": "string",
"text": "string",
"timestamp": 1
}
],
"scrollToken": "string"
}