Ignition Edge Historian - history clearance

I'm looking to clear the all history in Ignition Edge Gateway, is this possible? If so, how?

I have a bunch of data throughout the development of a project that needs to be cleared out!

You can delete the edge historian IDB file on disk, in the data directory of your Ignition install. Tread carefully, but it should be pretty clearly labeled. Exact path and filename will vary by your Ignition version.

Are either of the following more savory:

  • Backup, uninstall / reinstall, restore?
  • Connect with sqllite and delete old entries with a sql query?

Thanks! This would be a great feature addition :slight_smile:

Shutting down the gateway and deleting the file is going to achieve the same end result as either of those steps, and be faster and harder to mess up :man_shrugging:

Dealer's choice.

1 Like

If you want to automate this, you can do it with scripting.

Here’s some scripting to attach to a button or whatever other process:

import os
filePath = r"C:\Program Files\Inductive Automation\Ignition\data\local\tag-historian\edge_historian.idb"
if os.path.exists(filePath):
os.remove(filePath)

You can add whatever debugging or logging you want but that’s essentially all you need to do. A few caveats to doing it this way: This works for windows only, so if you have a gateway running on Linux or MacOS, the filePath variable will need to be the equivalent to those operating systems. If this is part of a standard project and you have Gateways on different platforms, you’ll need to somehow detect the operating system (perhaps by using os.path.exists and then looking for folders that are universal but unique to those specific operating systems, for example, if “C:\” exists then it is without a doubt a Windows machine. If “/System” or “/Applications” exists, it’s MacOS. If “/home” or “/root” exists then it’s probably Linux, etc.) and change the path according to whatever OS that gateway is running. Also, once you delete this file, you’ll need to restart the Ignition Gateway in order for the Historian to start working again. The file will be recreated if you delete it, but it doesn’t have anything in it, so Edge Historian will throw up a bunch of errors in the gateway logs about columns not existing and so forth. But if you restart the whole Gateway, it will create the file correctly.

They mentioned vision so this script if run on a client that is not the gateway computer this will not work. You will need a message handler to tie it together.

1 Like

Right. I assumed Perspective, but yes, this has to run on the Gateway, so a Client script in Vision won’t do unless the only Client is on the Gateway itself. I ran into something similar by trying to test on the script console from a remote laptop. I forgot the script console is always scoped to your local machine, not necessarily the Gateway.