• Home
  • Dynatrace API
  • Environment
  • Log Monitoring v1
  • Process groups
  • POST analysis job

Process group logs API v1 - POST analysis job

Starts the log analysis job.

Optionally, you can specify the timeframe of analysis, by providing the start and the end timestamp. You can also specify a query to filter log content.

The request produces an application/json payload.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/process-groups/{pgId}/logs/{logPath}
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/{pgId}/logs/{logPath}
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/process-groups/{pgId}/logs/{logPath}

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

All special characters in the log path must be escaped.

ParameterTypeDescriptionInRequired
pgIdstring

The Dynatrace entity ID of the required process group.

pathrequired
logPathstring

The full pathname of the log.

pathrequired
hostFilterstring

Narrows down the scope of the analysis to process groups, running at the specified hosts.

Specify the entity ID of the required host here. To specify several IDs, separate them with a comma.

queryoptional
querystring

Narrows down the scope of the analysis to the entries, matching the specified criteria.

The criteria must use the text pattern query syntax.

queryoptional
startTimestampinteger

The start timestamp of the analysis range, in UTC milliseconds.

If not set, then 2 hours behind from current timestamp is used.

queryoptional
endTimestampinteger

The end timestamp of the analysis range, in UTC milliseconds.

If not set, then the current timestamp is used.

queryoptional
bodyExtractFields

Extract fields from the log content to form custom columns.

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

The special characters must be escaped.

bodyoptional

Request body objects

The ExtractFields object

A query to extract log content to a custom column.

ElementTypeDescriptionRequired
parsingModestring

The parsing mode for log analysis entries presentation. Possible values are: json, disabled, and all.

optional
customParsingPatternsstring

The query for content extraction.

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

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
{ "parsingMode": "json", "customParsingPatterns": "\"user %{STRING:User} logged\", \"job took %{INTEGER:Time} ms\"" }

Response

Response codes

CodeTypeDescription
202

Success. The response body contains the ID of the job.

400ErrorEnvelope

Failed. See response body for details

404ErrorEnvelope

Not found. See response body for details

Example

In this example the request starts a log analysis job for the logs/var/log/syslog log of the PROCESS_GROUP-54A8B0B75D36E463 process group. The timeframe of analysis lies between timestamps 1470300000000 and 1470360000000.

The API token is passed in the Authorization header.

The response contains the ID of the started analysis job.

Curl

bash
curl -X POST \ https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/process-groups/PROCESS_GROUP-54A8B0B75D36E463/logs/%2Fvar%2Flog%2Fsyslog?startTimestamp=1470300000000&endTimestamp=1470360000000 \ -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/%2Fvar%2Flog%2Fsyslog?startTimestamp=1470300000000&endTimestamp=1470360000000

Response content

json
{ "jobId":"707306f2-f3c2-4f7b-a457-cf00f7a65b1d" }

Response code

202

Related topics
  • Log Monitoring Classic

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