ValueChange Script / Audit

Looking for best way to do this.

Illustrating this with single tag but it is much bigger then that.

I have a Tag that is reading from the PLC. Typically this value will be constant and is only changed by Design. The normal way of changing this is for an audit system we have that pushes the update to the PLC and then ignition reads new value from PLC. However due to length of audit system there is potential that we need to change that tag value from Ignition and have that write to the PLC.
So 3 ways that value can change - PLC, tag change in designer, Tag change via client

The part that I am trying to figure out best approach for is I want to build an audit log (SQL table)
ID, DateTime, TagChanged, OldValue, CurrentValue, ChangedByUser

which I have setup with a TagEvent Value Changed script which should cover all tag changes except the ChangedByUser part.

What I would like to include though is if the Tag is changed through either the designer or the Client I would like to include data of source of change and who was logged in for that change. Now if I put the SQL Insert for the audit in the entry field on the client then I would have a double entry (one from the tag changed script and one from the client entry script)

I think only Ignition's audit system will get you the detail you are after. Consider using an on-insert trigger on the audit table to capture specific events to insert to a separate table. (Or just filter for specific data at the time of query.)

What you don't get from ignition's audit log though is the previous value :frowning:

1 Like

I think I am stuck in case of either solution is not enough.

The Audit log captures who changed something but doesn't include the change values and doesn't include changes that happen from the PLC
The Tag change script (manual audit log) captures all changes and values but doesn't include user if done through Ignition.

If I make the manual audit log write from the vision component that did the change I will have 2 DB entries if I also have the tag change script. ?is there a way for tag change script to trigger dependent on source of change?

What I am currently at is having 2 audit logs Check manual log time and look in Ignition audit log for matching time for user source events.

This is what the tag historian is for though, not an auditing system. If you need to capture plc changes, add history to their tags

The function I am trying to do is a bit different then normal historian. I am not looking use any standard historian function and want to avoid having excess data.

For these particular tags (this is stuff like Name, Location that doesn't normally change)
We make a change in our Office DB Input ID 22 Name = Fred
We then take an excel sheet on site (site is without outside connectivity) and load those changes
We then go to the audit table I am creating and verify each of those changes and check for any changes that shouldn't have been made Verify Input ID 22 Name = Fred
while on site if additional changes need to be made we make those and when done run report / print table showing those tag changes (what input / ID , old value, new value, ..) then we go back to office and update the Office DB and repeat steps.

The "who did it" for local changes is nice to have but I think we just need to cross reference to audit log when we need to look into source of change.

That would be why you would configure it to only be stored On Change.

Oh well, multiple acceptable ways to achieve this.

1 Like