# Timestamp issue - nanoseconds needed for correct log ordering

**URL:** <https://community.dynatrace.com/t/timestamp-issue-nanoseconds-needed-for-correct-log-ordering/51226>\
**Category:** Logs\
**Tags:** dql, bizevents, business-analytics, business-events, logs\
**Created:** [April 14, 2025, 7:10pm UTC](https://community.dynatrace.com/t/timestamp-issue-nanoseconds-needed-for-correct-log-ordering/51226 "2025-04-14T19:10:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pditmar2](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@pditmar2](https://community.dynatrace.com/u/pditmar2)\
**Post date:** [April 14, 2025, 7:10pm UTC](https://community.dynatrace.com/t/timestamp-issue-nanoseconds-needed-for-correct-log-ordering/51226/1 "2025-04-14T19:10:17Z")

</div>

I have an issue with the timestamp of ingested logs. Dynatrace cuts out the nanoseconds, which in some cases make two events appear to be in the wrong order. This messes up my Business Flows. The actual timestamp that I would like to use, including nanoseconds, is available in the logs. At the arrow, you can see the record that is in the wrong order. In the screenshots you can see the “started” is listed after the “finished” because the nanoseconds get cut off.

Is there any way I can add the nanoseconds to the timestamp that is used by Dynatrace for ordering the logs (and for the business events).

 ![bizeventerror.jpg](https://global.discourse-cdn.com/dynatrace/original/3X/3/6/36dc8a4b5461cd83a7fd0d87b360bee45d7d7a38.jpeg)

![timestampnano.jpg](https://global.discourse-cdn.com/dynatrace/optimized/3X/1/6/16d220c2d448ddc7cb46b79c2239d149593466ae_2_690x49.jpeg)

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [November 18, 2025, 2:09pm UTC](https://community.dynatrace.com/t/timestamp-issue-nanoseconds-needed-for-correct-log-ordering/51226/2 "2025-11-18T14:09:52Z")

</div>

Hi&nbsp;[@pditmar2](https://community.dynatrace.com/user/21992),

In our internal resources, I’ve found a workaround, that could potentially solve your use case. Let us know if this helps:

_It looks like the issue may be related to how microseconds are being parsed and stored in Grail. By default, sorting on the&nbsp;`timestamp`&nbsp;field only goes down to the millisecond level, which can cause logs with identical timestamps to appear out of the expected order. As a workaround, you can enhance your sort logic by adding the&nbsp;`ordinal`&nbsp;field alongside&nbsp;`timestamp`. The&nbsp;`ordinal`&nbsp;reflects the order in which logs were ingested into Grail, which typically aligns with how they were emitted by the application. Here’s an updated query you can use:_

```markup
fetch logs
| filter matchesValue(status, { "INFO", "WARN", "ERROR" }) AND matchesValue(k8s.namespace.name, "namespace-name")
| sort timestamp, ordinal desc

```
