# Transaction logging

**URL:** <https://forum.inductiveautomation.com/t/transaction-logging/90456>\
**Category:** Ignition\
**Created:** [May 15, 2024, 5:39pm UTC](https://forum.inductiveautomation.com/t/transaction-logging/90456 "2024-05-15T17:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcs226](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lcs226](https://forum.inductiveautomation.com/u/lcs226)\
**Post date:** [May 15, 2024, 5:39pm UTC](https://forum.inductiveautomation.com/t/transaction-logging/90456/1 "2024-05-15T17:39:00Z")

</div>

I am logging data from our compressors to a data base using transaction groups.

My question is , can I calculate interval run time by finding that last time the compressor was started (already logging compressor running in 15 second intervals - "Compressor\_Running") and when the compressor stops, within the transaction group using a triggered expression or do I need to do this in Ignition outside of transactions ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 15, 2024, 5:45pm UTC](https://forum.inductiveautomation.com/t/transaction-logging/90456/2 "2024-05-15T17:45:14Z")

</div>

You should do this outside of transactions. The simplest tool is your database's `lead()` or `lag()` functions, that will allow you to find the timestamps where the condition changed.

If your transaction group is **only** logging running/not running, consider using a triggered transaction to only log the start/stop events. Virtually identical calculations, but much less data to chew through.

---

<div class="post-metadata">

**Author:** ![lcs226](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lcs226](https://forum.inductiveautomation.com/u/lcs226)\
**Post date:** [May 15, 2024, 5:48pm UTC](https://forum.inductiveautomation.com/t/transaction-logging/90456/3 "2024-05-15T17:48:01Z")

</div>

Tks,

I am already using triggered events but our suggestion gave me a different idea on how to get what I am looking for.
