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

Help required with API Ingest Request

Animesh
Newcomer

Hi,

I am unable to find an example or proper templete for my required API Ingest request. I want to ingest logs from a source and exclude records based on the metric servicename. Any log record containing the servicename="xyz" should be excluded from GRAIL storage. My Application interface from where i am ingesting the logs does not provide the capability to filter the logs based on servicename.  

1 REPLY 1

zaid-bashir
Advisor

Hi @Animesh 
To Ingest Logs Via API in Dynatrace is by using the following POST Request API Endpoint.

https://{environmentid}.live.dynatrace.com/api/v2/logs/ingest

 

Scope for the above API to work is to get Access Token of Scope logs.ingest. You will get token, then in POSTMAN you can open Headers and select Authorization and the value will be Api-Token <Your Token>. Make sure keep the request type as POST.
If the API is working on Bearer Token then you have create one OAuth Client and get the Token from that via other API.
Then the Token will be Bearer <Your-Token>.

The format for ingesting logs is like this:

[
  {
    "content": "Exception: Custom error log sent via Generic Log Ingest",
    "log.source": "/var/log/syslog",
    "timestamp": "2022-01-17T22:12:31.0000",
    "severity": "error",
    "custom.attribute": "attribute value"
  },
  {
    "content": "Exception: Custom error log sent via Generic Log Ingest",
    "log.source": "/var/log/syslog",
    "timestamp": "2022-01-17T22:12:35.0000"
  },
  {
    "content": "Exception: Custom error log sent via Generic Log Ingest",
    "log.source": "/var/log/syslog"
  },
  {
    "content": "Exception: Custom error log sent via Generic Log Ingest"
  }
]

 
Related To Filtering, I don't know which Application interface you are using, But what you can do, you can transform the Log Data and do some sort of filtering by writing some script which will contain that service name, then ingest the result data via API.

For your reference, Visit this URL related to Ingestion API's Log Ingestion API .

Featured Posts