Host logs API v1 - GET logs
Lists all the available OS logs on the specified host.
The request produces an application/json
payload.
GET | ManagedDynatrace for Government | 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}:9999/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{hostId}/logs |
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
Parameter | Type | Description | In | Required |
---|---|---|---|---|
hostId | string | The Dynatrace entity ID of the required host. | path | required |
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
Code | Type | Description |
---|---|---|
200 | LogList4hostResult | Success |
400 | ErrorEnvelope | Failed. See the response body for details |
Response body objects
The LogList4hostResult
object
OS logs available on the host.
Element | Type | Description |
---|---|---|
contentAccess | boolean | The access to the log content is granted ( |
logs | Log4host[] | The list of available OS logs. |
The Log4host
object
The list of available OS logs.
Element | Type | Description |
---|---|---|
availableForAnalysis | boolean | The log is available ( |
path | string | The full path to the log. |
size | integer | The size of the log, bytes. |
Response body JSON model
1{2 "contentAccess": true,3 "logs": [4 {5 "availableForAnalysis": true,6 "path": "string",7 "size": 18 }9 ]10}
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
1curl -X GET \2 https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-FE05D86A03025CAA/logs \3 -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
Request URL
1https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-FE05D86A03025CAA/logs
Response content
1{2 "contentAccess": true,3 "logs": [4 {5 "path": "Windows Application Log",6 "size": 20975616,7 "availableForAnalysis": true8 },9 {10 "path": "Windows System Log",11 "size": 16846848,12 "availableForAnalysis": true13 },14 {15 "path": "Windows Security Log",16 "size": 20975616,17 "availableForAnalysis": true18 }19 ]20}
Response code
200