# Detailed alarm log to csv

**URL:** <https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [March 20, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973 "2025-03-20T18:14:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Martin](https://avatars.discourse-cdn.com/v4/letter/n/85e7bf/32.png) [@Nick\_Martin](https://forum.inductiveautomation.com/u/Nick_Martin)\
**Post date:** [March 20, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/1 "2025-03-20T18:14:54Z")

</div>

Hi,  
I'm trying to export the Vision alarm log to a csv file but I'm stuck trying to add additional details beyond the standard dataset returned by:

`results = system.alarm.queryJournal(journalName="Journal")`

I know I can get additional properties from an individual alarm object with:

`results[0].label`

for example, but I not sure what the most efficient way is of adding those to the list of AlarmEvent objects returned by queryJournal, prior to exporting it all to a csv.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 20, 2025, 6:30pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/2 "2025-03-20T18:30:59Z")

</div>

> [@Nick\_Martin](#):
>
> for example, but I not sure what the most efficient way is of adding those to the list of AlarmEvent objects returned by queryJournal

I'm not sure I completely understand what problem you are trying to solve. The additional properties are already a part of dataset, what are you trying to add?

Can you provide any code that shows what you've tried and explain what you expected and what the issue was with the actual result that was not what you expected?

---

<div class="post-metadata">

**Author:** ![Nick\_Martin](https://avatars.discourse-cdn.com/v4/letter/n/85e7bf/32.png) [@Nick\_Martin](https://forum.inductiveautomation.com/u/Nick_Martin)\
**Post date:** [March 20, 2025, 7:56pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/3 "2025-03-20T19:56:27Z")

</div>

For this alarm in the journal:

![image](https://us1.discourse-cdn.com/inductiveautomation/optimized/3X/a/4/a4b2b8388a5efd8a5fb9f275a05c5502d2f663e7_2_690x67.png)

The following code:

```python
results = system.alarm.queryJournal(journalName="AlarmJournal", startDate=system.date.addMinutes(system.date.now(),-1), endDate=system.date.now())

print results[0]
print results[0].label

csv = system.dataset.toCSV(results)

filePath = system.file.saveFile("myExport.csv", "csv", "Comma Separated Values")

if filePath:
    system.file.writeFile(filePath, csv)

```

Returns this in the console:

```python
Event[name=Changed, source=prov:default:/tag:GlobalVars/BH1_setpoint_min:/alm:Changed, priority=Diagnostic, desc=null]
Changed

```

And this in the .csv file:

```python
"value"
"[{Source: 'prov:default:/tag:GlobalVars/BH1_setpoint_min:/alm:Changed', Display Path: 'BH1_setpoint_min', UUID: '84408903-9ca4-43e3-b606-fbc37c724018', Current State: 'Active, Acknowledged', Priority: 'Diagnostic', Active Data: {ackUser=tag:Auto-Ack, systemAck=true, eventTime=Fri Mar 21 08:39:10 NZDT 2025}, Clear Data: null, Ack Data: {ackUser=tag:Auto-Ack, eventTime=Fri Mar 21 08:39:10 NZDT 2025}, Runtime Data: {eventState=Active, eventTime=2025-03-21 08:39:10.0}}, {Source: 'prov:default:/tag:GlobalVars/BH1_setpoint_min:/alm:Changed', Display Path: 'BH1_setpoint_min', UUID: 'da5a9dd0-10f0-420d-836e-aa85ad64d41a', Current State: 'Active, Acknowledged', Priority: 'Diagnostic', Active Data: {ackUser=tag:Auto-Ack, systemAck=true, eventTime=Fri Mar 21 08:39:19 NZDT 2025}, Clear Data: null, Ack Data: {ackUser=tag:Auto-Ack, eventTime=Fri Mar 21 08:39:19 NZDT 2025}, Runtime Data: {eventState=Active, eventTime=2025-03-21 08:39:19.0}}]"

```

But what I really want is the label property from here:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/0/b08b2e7518195947aa5dd1609b41f4c5adfa35a9.png)

As circled in red in the top image.

I'm also bit confused because `print results[0].label` seems to return the name property rather than the label property I'm after...

In any case I just want to include the real label property "BH1 band control min limit set to 116 C" in the csv output as that gives the most information about what the alarm actually represents.

Thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 20, 2025, 8:23pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/4 "2025-03-20T20:23:36Z")

</div>

> [@Nick\_Martin](#):
>
> I'm also bit confused because `print results[0].label` seems to return the name property rather than the label property I'm after...

Well, in the SDK it states that `getLabel()` Returns the "Label" property, or "Name" if not defined.

Which, since, it is clearly defined, is confusing and I would say this looks like potentially a bug.

That being said, you would need to add a column to the dataset. Something like this:

```python
results = system.alarm.queryJournal(journalName="AlarmJournal", startDate=system.date.addMinutes(system.date.now(),-1), endDate=system.date.now())

labelColumn = [result.label for result in results]
resultsDS = results.dataset
resultsDS = system.dataset.addColumn(resultsDS,labelColumn,"Label",str)

csv = system.dataset.toCSV(results)

filePath = system.file.saveFile("myExport.csv", "csv", "Comma Separated Values")

if filePath:
    system.file.writeFile(filePath, csv)

```

I would recommend that you reach out to IA support and have them look over your shoulder and determine if this is a bug or if something else is going on.

---

<div class="post-metadata">

**Author:** ![Nick\_Martin](https://avatars.discourse-cdn.com/v4/letter/n/85e7bf/32.png) [@Nick\_Martin](https://forum.inductiveautomation.com/u/Nick_Martin)\
**Post date:** [March 20, 2025, 9:32pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/5 "2025-03-20T21:32:29Z")

</div>

Thanks heap, that's really helpful

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 20, 2025, 10:32pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/6 "2025-03-20T22:32:20Z")

</div>

Is your alarm journal set up to store dynamic config? That's the default, but could have been changed:

> **[Alarm Journal | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/alarming/alarm-journal#journal-properties)**
>
> By default, current alarm data is only stored in memory, and a finite number of events are retained for each alarm. Fortunately, Ignition can easily be configured to store alarm data into a SQL database with an Alarm Journal Profile. The journal can...

Without that setting checked, your journal query will not have any stored label to return to you.

---

<div class="post-metadata">

**Author:** ![Nick\_Martin](https://avatars.discourse-cdn.com/v4/letter/n/85e7bf/32.png) [@Nick\_Martin](https://forum.inductiveautomation.com/u/Nick_Martin)\
**Post date:** [March 23, 2025, 8:54pm UTC](https://forum.inductiveautomation.com/t/detailed-alarm-log-to-csv/103973/7 "2025-03-23T20:54:51Z")

</div>

PGriffith, yes the Dynamic Config is stored:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/a/7adb609244e156b068648c651f7b07bf87d3b74f.png)

I hadn't thought to check that so thanks!
