• Home
  • Dynatrace API
  • Environment
  • Log Monitoring v1
  • Hosts
  • GET logs

Host logs API v1 - GET logs

Lists all the available OS logs on the specified host.

The request produces an application/json payload.

GETManaged https://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs
SaaS https://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/{hostId}/logs
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs

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
hostIdstring

The Dynatrace entity ID of the required host.

pathrequired

Response

The result is a JSON, containing the array of objects, each representing a log.

  • For the default environment, the availableForAnalysis attribute is always set to true.
  • For upgraded Log Monitoring environments, the availableForAnalysis attribute is set to true when the stored log is ready for analysis.

Response codes

CodeTypeDescription
200LogList4hostResult

Success

400ErrorEnvelope

Failed. See the response body for details

Response body objects

The LogList4hostResult object

OS logs available on the host.

ElementTypeDescription
contentAccessboolean

The access to the log content is granted (true) or denied (false).

Can be null.

logsLog4host[]

The list of available OS logs.

Can be null.

The Log4host object

The list of available OS logs.

ElementTypeDescription
pathstring

The full path to the log.

Can be null.

sizeinteger

The size of the log, bytes.

Can be null.

availableForAnalysisboolean

The log is available (true) or not available (false) for analysis.

Can be null.

Response body JSON model

json
{ "contentAccess": true, "logs": [ { "path": "string", "size": 1, "availableForAnalysis": true } ] }

Example

In this example the request lists the OS logs from the HOST-FE05D86A03025CAA host.

The API token is passed in the Authorization header.

The response contains OS logs of this host.

Curl

shell
curl -X GET \ https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-FE05D86A03025CAA/logs \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-FE05D86A03025CAA/logs

Response content

json
{ "contentAccess": true, "logs": [ { "path": "Windows Application Log", "size": 20975616, "availableForAnalysis": true }, { "path": "Windows System Log", "size": 16846848, "availableForAnalysis": true }, { "path": "Windows Security Log", "size": 20975616, "availableForAnalysis": true } ] }

Response code

200

Related topics
  • Log Monitoring

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