• Home
  • Dynatrace API
  • Environment
  • Log Monitoring v1
  • Process groups
  • GET log content

Process group logs API v1 - GET 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.

GETManaged https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/process-groups/{pgId}/logs/jobs/{jobId}/records
SaaS https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/{pgId}/logs/jobs/{jobId}/records
Environment ActiveGate https://{your-activegate-domain}/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 Read logs (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

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

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.

Can be null.

scrollTokenstring

The scroll token for the next page of results.

Without it you'll get the first page again.

Can be null.

The LogRecord object

The analysis result for a single log entry.

ElementTypeDescription
timestampinteger

The timestamp of the log entry, in UTC milliseconds.

Can be null.

logLevelstring

The severity level of the log entry.

Can be null.

hostIdstring

The entity ID of the host that produced the log.

Not applicable to OS logs.

Can be null.

textstring

The text of the log entry.

Can be null.

customFieldsobject

The map of the log entry custom fields.

Can be null.

Response body JSON model

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

Example

In this example the request lists the content of the logs/Fvar/Flog/Fsyslog log of the PROCESS_GROUP-54A8B0B75D36E463 process group, which has been processed by the job with ID 707306f2-f3c2-4f7b-a457-cf00f7a65b1d.

The API token is passed in the Authorization header.

The response contains entries of this log. It is truncated to two entries.

Curl

shell
curl -X GET \ https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/PROCESS_GROUP-54A8B0B75D36E463/logs/jobs/707306f2-f3c2-4f7b-a457-cf00f7a65b1d/records \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/PROCESS_GROUP-54A8B0B75D36E463/logs/jobs/707306f2-f3c2-4f7b-a457-cf00f7a65b1d/records

Response content

json
{ "records":[ { "text":"Aug 4 10:46:07 all services working well", "timestamp":1470300367000 }, { "text":"Aug 4 10:46:08 all services stopped", "timestamp":1470300368000 } ], "scrollToken":"64" }

Response code

200

Related topics
  • Log Monitoring

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