Generic log ingest API v2

Note: This feature is currently available in Preview. Be sure to read the Disclaimer.

Dynatrace version 1.206+

Ingested logs are stored to indexed log storage.

POST

  • Managed: https://{your-domain}/e/{your-environment-id}/api/v2/logs/ingest
  • SaaS: https://{your-environment-id}.live.dynatrace.com/api/v2/logs/ingest

Authentication

To execute this request, you need the Log import (LogImport) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.

Parameters

No parameters

Request parameters

This is the log message in JSON or plain text format, depending on the request Content-Type specification.

  • In the case of plain text format, the message represents a single log event.
  • In the case of JSON format, the message can be a single JSON object representing a single event or an array of JSON objects representing a set of events. The JSON object, as a set of key-value pairs, may contain the keys of the following categories: timestamp, content, severity, or semantic attribute. For more information on key-value pairs, examine the request body scheme in the product API.

List of possible log attributes coming soon.

Response codes

Code Description
200 Success
400 Failed. The input is invalid.
401 Missing authorization parameter.
415 Unsupported Content-Type.

Example

In this example the request ingests log data that will create a log event with defined log attributes content, status, service.name and service.namespace.

The API token is passed in the Authorization header.

The response contains response code 200.

Curl

curl -X POST \
  https://mySampleEnv.live.dynatrace.com/api/v2/logs/ingest \
  -H 'Content-Type: application/json; charset=utf8' \
  -H 'Authorization: Api-Token abcdefjhij1234567890' \
  -d '[
		{
		"content": "Exception: Custom error log sent via Generic Log Ingest",
		"status": "error",
		"service.name": "log-monitoring-tenant",
		"service.namespace": "dev-stage-cluster"
		}
]'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v2/logs/ingest

Response content

Success

Response code

200