Summary
This guide covers how to push custom logs to Dynatrace using the Log Monitoring API (POST /logs/ingest). It applies to both SaaS environments and ActiveGate deployments with the Log Analytics Collector module enabled.
Troubleshooting steps
1. Verify API Endpoint
- Confirm you’re using the correct endpoint:
- SaaS:
https://{environmentid}.live.dynatrace.com/api/v2/logs/ingest - ActiveGate:
https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/logs/ingest
2. Check Authentication
- Ensure your access token includes the
logs.ingestscope. - Validate token format and expiration.
3. Validate Headers
Authorization: Api-Token {your-token}Content-Type: Must be one of:text/plainapplication/jsonapplication/jsonlapplication/x-ndjson
4. Inspect Payload Format
- Confirm UTF-8 encoding.
- For JSON payloads:
- Use an array of log objects.
- Include required fields like
content,timestamp, andseverity. - Flatten nested attributes using dot notation.
5. Check Timestamp Validity
- Ensure timestamps are:
- In UTC
- RFC3339 or RFC3164 format
- Not older than 24 hours
6. Review Attribute Depth
- Limit nesting to 5 levels.
- Avoid conflicting keys (Dynatrace will prefix with
overwritten1, etc.).
7. Monitor Response Codes
200 OK: Success (some logs may be dropped)204 No Content: Success400 Bad Request: Check payload structure401 Unauthorized: The token is invalid402 Payment Required: Failed. This is due either to the status of your licensing agreement or because you’ve exhausted your DPS license.403 Forbidden: The token lacks the proper permissions404 Not Found: Failed. The requested resource doesn’t exist. This may happen when no ActiveGate is available with the Log Analytics Collector module enabled.413 Payload Too Large: Reduce payload size429 Too Many Requests: Apply exponential backoff503 Service Unavailable: Retry later
8. Enable Semantic Attributes (Optional)
- Use attributes like
host.name,http.status_code,dt.entity.servicefor enhanced querying.
Limitations
Please refer to the following documentation pages:
What’s next
If this article did not help, please open a support ticket, mention that this article was used and provide the following information:
- Link to tenant
- API endpoint used
- Responses to ingest requests including response codes and messages