# Help required with API Ingest Request

**URL:** <https://community.dynatrace.com/t/help-required-with-api-ingest-request/50793>\
**Category:** Dynatrace API\
**Tags:** logs, dynatrace-api\
**Created:** [March 20, 2025, 5:27am UTC](https://community.dynatrace.com/t/help-required-with-api-ingest-request/50793 "2025-03-20T05:27:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Animesh](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@Animesh](https://community.dynatrace.com/u/Animesh)\
**Post date:** [March 20, 2025, 5:27am UTC](https://community.dynatrace.com/t/help-required-with-api-ingest-request/50793/1 "2025-03-20T05:27:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zaid-bashir](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/zaid-bashir/32/22651_2.png) [@zaid-bashir](https://community.dynatrace.com/u/zaid-bashir)\
**Post date:** [March 20, 2025, 5:53am UTC](https://community.dynatrace.com/t/help-required-with-api-ingest-request/50793/2 "2025-03-20T05:53:41Z")

</div>

Hi&nbsp;[@Animesh](https://community.dynatrace.com/user/71674)&nbsp;  
To Ingest Logs Via API in Dynatrace is by using the following POST Request API Endpoint.

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

```

Scope for the above API to work is to get Access Token of Scope&nbsp; **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\>.** &nbsp;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:

```javascript
[
  {
    "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&nbsp;[Log Ingestion API](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/log-monitoring-v2/post-ingest-logs)&nbsp;.
