# Keep Latest Logs with Custom Processing Rules in DQL

**URL:** <https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892>\
**Category:** DQL\
**Tags:** dql, log-processing, logs\
**Created:** [June 3, 2024, 3:12pm UTC](https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892 "2024-06-03T15:12:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexisGND](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AlexisGND](https://community.dynatrace.com/u/AlexisGND)\
**Post date:** [June 3, 2024, 3:12pm UTC](https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892/1 "2024-06-03T15:12:32Z")

</div>

Hello,  
I want to make a processing rule to filter out an entire log.

Here’s the log sample :

```javascript
[
    {
      "interface.name": "Seq_SAP_to_AGV",
      "host.environment": "PROD",
      "host.name": "Datastage",
      "content": "Seq_SAP_to_AGV Finished - OK",
      "execution.status": "Finished - OK",
      "execution.starttime": "2024-05-28 14:00:34",
      "execution.endtime": "2024-05-28 14:01:34",
      "event.type": "LOG",
      "loglevel": "NOTICE",
      "interface.target.domain": "MFG",
      "ID": "Seq_SAP_to_AGV#28052024.140034",
      "timestamp": "2024-05-28T14:00:34.000000000Z",
      "status": "INFO"
    },
    {
      "interface.name": "Seq_SAP_to_AGV",
      "host.environment": "PROD",
      "host.name": "Datastage",
      "content": "Seq_SAP_to_AGV Running - no warnings",
      "execution.status": "Running - no warnings",
      "execution.starttime": "2024-05-28 14:00:34",
      "event.type": "LOG",
      "loglevel": "NOTICE",
      "interface.target.domain": "MFG",
      "ID": "Seq_SAP_to_AGV#28052024.140034",
      "timestamp": "2024-05-28T14:00:34.000000000Z",
      "status": "INFO"
    }
  ]

```

As you can see, the “ID” is the same between these 2 logs because i received a “Running” status first and a “Finished” status at the end.

Now my need is to filter out all of the other informations who contains “Running with…” with this ID because it is an outdated information since I received the same one with the “Finished with…” and the “endtime”.

If I want to speak with other words : I want to keep only the latest information received from the timestamp for every ID.

Is it possible ?  
Thanks in advance 🙂

Alexis

---

<div class="post-metadata">

**Author:** ![Malaik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/malaik/32/32673_2.png) [@Malaik](https://community.dynatrace.com/u/Malaik)\
**Post date:** [June 4, 2024, 6:44am UTC](https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892/2 "2024-06-04T06:44:26Z")

</div>

Hi,

I have a similar need (But mine is a little complex).

For your case I can suggest to drop logs that contain&nbsp;“Running” … and with this rule you will keep only&nbsp;“Finished with…” and the “endtime”…

Hope this help.

---

<div class="post-metadata">

**Author:** ![AlexisGND](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AlexisGND](https://community.dynatrace.com/u/AlexisGND)\
**Post date:** [June 4, 2024, 3:29pm UTC](https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892/3 "2024-06-04T15:29:08Z")

</div>

Hello,

Thanks for your suggestion but unfortunately my need is to also display the running datas for those who are actually running in my dashboards 😕

But the idea of making multiple queries, then to be able to assemble them in one DataTable is possible with my NodeJs custom app on Dynatrace.

I will try this method instead until i find something relevant to this log processing rule.

Thanks again 😉  
Alexis

---

<div class="post-metadata">

**Author:** ![izabelarokita](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/izabelarokita/32/41812_2.png) [@izabelarokita](https://community.dynatrace.com/u/izabelarokita)\
**Post date:** [December 18, 2025, 2:26pm UTC](https://community.dynatrace.com/t/keep-latest-logs-with-custom-processing-rules-in-dql/45892/4 "2025-12-18T14:26:59Z")

</div>

Hey&nbsp;[@AlexisGND](https://community.dynatrace.com/user/68059)&nbsp;,

I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you!&nbsp;:blush:  
Please let me know what works best for you.
