# queryAuditLog find limited number of most recent matches

**URL:** <https://forum.inductiveautomation.com/t/queryauditlog-find-limited-number-of-most-recent-matches/52519>\
**Category:** Ignition\
**Created:** [October 29, 2021, 7:43pm UTC](https://forum.inductiveautomation.com/t/queryauditlog-find-limited-number-of-most-recent-matches/52519 "2021-10-29T19:43:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 29, 2021, 7:43pm UTC](https://forum.inductiveautomation.com/t/queryauditlog-find-limited-number-of-most-recent-matches/52519/1 "2021-10-29T19:43:59Z")

</div>

As our system makes more use of the audit log for recording important events, we’re also finding use cases where we want to quickly fetch and display the most recent instances of certain events.

I’ve peeked at the DB side of the audit log and have even done some manual `SELECT` queries with `ORDER BY EVENT_TIMESTAMP LIMIT 1` find the most recent time something happened.

I feel like the ability to do this via the `queryAuditLog` script function would be very handy, and might even become somewhat necessary as the logs get bigger and we’re unsure if the thing were looking for is recent or _waaaaay_ back in time. Right now I can either walk the time range backward with multiple smaller queries until I find one, or I can query way too much time at once and sort/reduce the result in scripting, both of which are inefficient compared to letting the SQL handle it.

Is this something that could plausibly be added to `queryAuditLog`?
