How do I start a log retrieval job?

You can start a log retrieval job based on host ID or on process group. You must provide either a host ID or a process group ID, and a full path to the log file. Optionally, you can provide the start and end timestamp as well as query to filter any log content.

POST start log retrieval job

A call to the entity/infrastructure/hosts/<hostId>/logs/<logPath> endpoint starts OS log retrieval job for given host.

POST
  • Managed https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/<hostId>/logs/<logPath>
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/<hostId>/logs/<logPath>

A call to the entity/infrastructure/process-groups/<pgId>/logs/<logPath> endpoint returns a list of logs of indicated process group.

POST
  • Managed https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/<pgId>/logs/<logPath>
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/<pgId>/logs/<logPath>

Once you execute the call, the following status codes indicate the success or failure of the call:

  • 202 - Accepted
    • Successful execution of the call
  • 400 - Bad Request
    • Wrong hostId or pgId parameter (provided hostId or pgId is invalid)
    • Wrong hostFilter parameter (provided hostFilter is invalid)
    • Wrong time range parameters
  • 404 - Not Found
    • Host with agent or log was not found
    • Process group or log was not found
    • None of the specified hosts by hostFilter were not found