cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API to pull the exception and it's count

Shruts
Participant

Hi,

I wanted to pull all the exception that occurred with it's counts using API. Can I fetch the result by using provided API and if yes then let me know the API details. 

5 REPLIES 5

radek_jasinski
DynaMight Guru
DynaMight Guru

Hi @Shruts 

To retrieve exceptions and their counts using the Dynatrace API, you can utilize the Dynatrace Problem and Event Feed API or the Logs API, depending on the exact nature of the data you're interested in.

  • Problem and Event Feed API: This API provides detailed information about problems detected in your monitored environment. It might include exception data if these exceptions are part of broader problems detected by Dynatrace.
  • Logs API: If you're specifically interested in exceptions as they are logged, the Logs API would be the right choice. This API allows you to query log data, which can include exception details.

Example:

GET https://{your-environment-id}.live.dynatrace.com/api/v2/logs/query
Authorization: Api-Token {your-api-token}
Content-Type: application/json

{
"query": "log level ERROR | count",
"from": "now-2d",
"to": "now"
}

Radek

Have a nice day!

Hi,

Can you send API documentation link or swagger document link for Logs API? Because couldn't able to find this API in given swagger doc. 

Thanks & Regards,
Shruti  

Hi,

 

You can find swagger in Managed >> Access tokens

Zrzut ekranu 2023-12-7 o 12.53.59.png

https://docs.dynatrace.com/docs/shortlink/api-events-v2

Radek

Have a nice day!

mark_bley
Dynatrace Pro
Dynatrace Pro

You may be looking for this information displayed in the multidimensional analysis tool

mark_bley_0-1702025289234.png

There you can create a Metric based on the Exceptions and the count.

Once you have the metric you can easily pull the information from /api/v2/metrics

You may need to filter down the search using a specific service or request otherwise it may not work if you have too much data in your environment.

Please note that creating additional metrics consumes the DDU licence.

Have a nice day!

Featured Posts