Document Audit
Feature
Germain's Document Audit mechanism allows for the storage and tracking of document changes as events, providing a history of document modifications in real-time. This mechanism is useful in various use cases:
Data Audit Trail
It enables the tracking and auditing of changes to structured data, such as records, in external systems. Germain can connect to these systems via REST, SQL, SOAP, or other protocols to capture and store the changes.
Business Data Status
The Document Audit mechanism can track the duration that a record remains in a specific status. This information is valuable for monitoring and analyzing the time taken to respond to tickets, resolve service requests, or any other business process where the status progression is important.
User Behavior Analytics
Germain can collect statistics on user behavior, providing insights into how users interact with records or documents. This information can include metrics such as the number of times a user edits a record or identifying the most active or prolific editors within a system.
Alert on Content
Germain can trigger alerts or events based on the content of document fields. This functionality allows for the identification of specific keywords or patterns within documents that may require immediate attention or further action.
These use cases demonstrate the versatility of Germain's Document Audit mechanism in tracking and analyzing data changes, monitoring business processes, understanding user behavior, and enabling proactive alerting based on document content.
For example, Germain can help track the time taken to respond to a support ticket, measure the resolution time for service requests, collect and analyze user behavior statistics, and generate alerts based on specific document field content.
Overall, Germain's Document Audit mechanism provides valuable capabilities for data auditing, business process monitoring, user behavior analysis, and content-based alerting, enhancing organizations' ability to manage and derive insights from their data and documents.
Configuration
Consume DocumentChange outputs
Customize the “document-audit-default” Rule or create a new Rule for processing the DocumentChange events output by the Document Service. (In the configuration console, make sure germain.apm.documentAudit.rule
is set to document-audit-default
or the name of your new Rule.)
The “document-audit-default” Rule customized for Siebel Service Requests:
package com.germainsoftware.apm.analytics.audit;
dialect "mvel"
import com.germainsoftware.apm.data.model.*;
import com.germainsoftware.apm.storage.documentAudit.DocumentChange;
import java.time.*;
global org.slf4j.Logger logger;
global com.germainsoftware.apm.storage.StorageService storage;
rule "Siebel Service Request Rule"
when
$update : DocumentChange( documentType == "Siebel SR", path == "status" )
then
logger.info("SR Change: {}", $update.value);
// create new SR Status Changed Event
GenericEvent ev = new GenericEvent();
ev.name = $update.documentType;
ev.type = "Siebel:SR Change";
ev.timestamp = $update.timeCreated;
ev.businessObject = $update.value;
ev.sequence = $update.documentId;
storage.insertFact(ev);
retract($update)
end
Schema of a DocumentChange:
class DocumentChange {
String documentId;
String documentType;
Map<String, String> documentMetadata;
ValueMap documentBody;
OffsetDateTime timeCreated;
Map<String, String> metadata;
String author;
String path;
Object value;
Object oldValue;
}
Generate DocumentUpdate inputs (engine)
Customize the Rule(s) used by the various monitoring components (e.g. QueryMonitor) to generate DocumentUpdate events for input into the Document Service.
The following is an example based around Siebel Service Requests. The SQL used by the QueryMonitor:
select LAST_UPD, ROW_ID, CREATED, CREATED_BY, LAST_UPD_BY, SR_NUM, SR_PRIO_CD, SR_SEV_CD, SR_STAT_ID, SR_TITLE
from SIEBEL.S_SRV_REQ
where LAST_UPD > ?
order by LAST_UPD asc
The Rule referenced by the QueryMonitor:
import java.util.Calendar;
import java.util.regex.*;
import java.time.*;
import java.time.temporal.*;
import com.germainsoftware.apm.config.data.*;
import com.germainsoftware.apm.converter.*;
import com.germainsoftware.apm.data.model.*;
import com.germainsoftware.apm.data.indexer.*;
import com.germainsoftware.apm.message.*;
import com.germainsoftware.apm.model.*;
import com.germainsoftware.apm.router.*;
global org.slf4j.Logger logger;
global com.germainsoftware.apm.converter.DatamartConverter datamart;
global com.germainsoftware.apm.router.RouterContext context;
rule "Siebel SR"
when
$msg : QueryResultMessage( category == "Siebel SR" )
then
DocumentUpdate doc = new DocumentUpdate($msg.getString(1), "Siebel SR", $msg.getString(4));
doc.timestamp = $msg.getTimestamp(0); // LAST_UPD
doc.set("created", $msg.getTimestamp(2).toString()); // CREATED
doc.set("createdBy", $msg.getString(3)); // CREATED_BY
doc.set("number", $msg.getString(5)); // SR_NUM
doc.set("priority", $msg.getString(6)); // SR_PRIO_CD
doc.set("severity", $msg.getString(7)); // SR_SEV_CD
doc.set("status", $msg.getString(8)); // SR_STAT_ID
doc.set("title", $msg.getString(9)); // SR_TITLE
Queues.postDocumentUpdate(doc);
retract($msg);
end
Schema of a DocumentUpdate:
interface DocumentUpdate {
DocumentUpdate(String documentId, String documentType, String author);
OffsetDateTime timestamp;
HashMap<String, String> documentMetadata; // Custom properties about the document e.g. { title: 'My First Opportunity' }
void addAttribute(String attributeName, String value); // Set custom properties about this change
void set(String path, @Nullable Object value); // Set fields of the document. The format of paths: "child.grandchild.greatgrandchild"
void deletePath(String path); // To drop a field from a document.
}
Generate DocumentUpdate inputs (Web UX)
Customize the initScript
, of the corresponding Web-UX Monitoring Profile, to generate DocumentUpdate events for input into the Document Service.
BOOMR.utils.addToDocumentAuditQueue(update: DocumentUpdate);
type DocumentUpdate = {
documentId: string
documentType: string
documentMetadata: Record<string, string> // Custom properties about the document
timestamp: number
author: string
metadata: Record<string, string> // Custom properties about this change
fieldUpdates: FieldUpdate[]
}
type FieldUpdate = {
path: string
valueJson: string
spliceIndex: number
deleteCount: number
}
Notes
All this may change depending on your data sources and requirements
Service: Analytics
Feature Availability: 2022.1 or later