Skip to content

Advanced Topics Audity

Roi Shabtai (saturn) edited this page Sep 28, 2020 · 6 revisions

Using AnyService you are able to create complete audit log for every entity configured. Audit data is persist to AuditRecord and can be fetched using __audit endpoint.

There are 4 types of audit records:

  • Create - Created once, whenever an entity is created
  • Read - Created multiple times, every time the entity is fetched
  • Update - Created multiple times, every time the entity is updated
  • Delete - Created once, whenever an entity is deleted

To set an entity as auditable, it must inherit from one of the following interfaces:

  • ICreatableAudit
  • IReadableAudit
  • IUpdatableAudit
  • IDeletableAudit
  • IFullAudit - Contains all audit types

AuditSettings

AuditSettings configures how audit is handled and is configured by settings the AuditSettings property in AnyServiceConfig.

Turn on/off an audit

Audit may makes the traffic to the persistency layer expensive. It can be deactivate entirely, per entity and or per audit type

  • To deactivate audit entirey on server level, set the AuditSettings.Active property to false. This step deactivates all audit behavior
  • To deactivate per audit type
  • Server level deactivation is done by seting the values of AuditSettings.AuditRules in AnyServiceConfig's to false (by audit type)
  • Entity level deactivation is done by seting the values of AuditSettings.AuditRules in entity's EntityConfigRecord to false (by audit type). Note that server level's AuditRules are overriden by entity's AuditRules