Forcing Smarts SAM to archive cleared notifications

The following example ASL script shows how to force SAM to "archive" all cleared notifications immediately.

This is not normally required since SAM has it's own configurable archival policy, but from time to time it is useful to do this - for example to reduce the size of the repository before shutting SAM down and restarting it, potentially resulting in a faster start-up.

The "print" statement is just there to give feedback about what the script is doing, and can be removed without changing the logic. The value "n" is there to indicate how many more notifications there are left to process.

START { .. eol } do {
        nl = object("ICS_NL-ALL_NOTIFICATIONS");
        all = nl->AllNotifications;
        n = sizeof(all);
        foreach notif (all) {
                if (!object(notif)->Active) {
                        print(n." -- ".notif->DisplayName);
                        nl->archive(notif, "System", "Forced Archive");
                        n = n - 1;
                }
        }
}

You can run the script using the sm_adapter command, like this..

sm_adapter -s DOMAIN_NAME_HERE SCRIPT_NAME_HERE.asl
Scroll to Top