08 Sep 2025 07:50 AM
Hi All,
I am trying to fetch logs data from Dynatrace using GET API using bearer authentication, but I am not able to do so. It is always throwing some error:
I have already provided required access to user, IAM polices and oauth client Scope required to get the logs from Dynatrace.
Scope access provided:
logs.ingest
logs.read
storage:logs:read
storage: buckets:read
API URL:
curl -k -L -X GET "https://{environmentid}.live.dynatrace.com/api/v2/logs/query" -H "Authorization: Bearer Access_token" -H "Accept: application/json" – d '{"query": "fetch logs | limit 10"}'
08 Sep 2025 10:38 AM
curl -sS -X POST \
"https://{environmentid}.live.dynatrace.com/platform/storage/query/v1/query:execute" \
-H "Authorization: Bearer ${OAUTH_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"query": "fetch logs | limit 10",
"requestTimeout": "30s",
"preview": false
}'