ThingWorx Model Definition and Composer > System > Subsystems > Audit Subsystem > Audit Archive, Export, and Clean-up Operations > Archiving Audit Data
Archiving Audit Data
The DaysOnline parameter of the Audit Subsystem controls how long audit data remains online. This parameter specifies the number of days that online data should remain in the online storage. The default number of days is 60. If you keep this default value, any data that is older than 60 days is automatically removed from the online storage after the completion of an archive operation or after the archive part of the export operation.
The Audit Subsystem configuration also controls the maximum number of rows that an audit table can hold (maxEntriesOnlineAuditData). before data is subject to being purged from the online table (after having been archived to offline storage). The default value of this parameter is 500000 rows.
To prevent any system degradation, it is recommended that you archive audit messages automatically at scheduled intervals. These intervals can be daily, weekly, or monthly. All audit data is archived from online storage to offline storage (AuditArchiveFileRepository). Entries that are older than the days specified for the DaysOnline parameter of the Audit Subsystem or an audit table whose size exceeds the maximum number of rows specified for maxEntriesOnlineAuditData are then purged on a daily basis. A Scheduled Job is configured for this operation in ThingWorx Composer (AuditArchiveScheduler)
By default, the automatic archive operation is set up to run daily. You can change the schedule by changing the configuration of the AuditArchiveScheduler thing in ThingWorx Composer. The AuditArchiveScheduler has a property that shows the last run time of a scheduled job (LastArchivedTime). After every successful run of a scheduled archive job, the system updates this property. Note that although it is possible, this property should NEVER be edited manually by a user, admin or non-admin.
To edit the schedule, follow these steps:
1. Assuming that you are logged in to ThingWorx Composer, click the Browse tab on the left pane, and then click Things.
2. When you see the list of things, click AuditArchiveScheduler.
3. Click Configuration to display the General Settings, shown here:
4. Set the properties for the AuditArchiveScheduler
runAsUser — This property is EMPTY by default. Do NOT change it. This property specifies the user context within which the ScheduledEvent is fired. In addition, subscriptions to that event will also run in that user context.
schedule — Specifies a cron pattern that defines the schedule for running the archive operation automatically.
enabled — Specifies whether the automatic archive is enabled. Select the check box to enable or disable the scheduler.
5. Click the Save button.