MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Alerting

Alerting

The Audit Service provides rule-based alerting on audit events through the AuditAlertRule entity and associated alert evaluation logic. Alert rules can detect security threats, policy violations, and anomalous behavior by matching event patterns, monitoring thresholds, and analyzing activity windows.


Alert Rule Types

Rule TypeDescription
EVENT_MATCHTriggers when specific event types or actions occur
THRESHOLDTriggers when event count exceeds a threshold within a time window
ANOMALYDetects anomalous patterns against established baselines
FAILED_AUTHMultiple failed authentication attempts
SENSITIVE_DATA_ACCESSMonitors access to sensitive resources
AFTER_HOURSActivity outside configured business hours
RATE_LIMITRate limiting violation patterns

Alert Severity Levels

SeverityDescription
LOWInformational, no immediate action required
MEDIUMShould be investigated within business hours
HIGHRequires prompt attention
CRITICALRequires immediate response

AuditAlertRule Entity

FieldTypeDescription
idUUIDRule identifier
tenantIdUUIDOwning tenant
nameStringHuman-readable rule name
descriptionStringRule description
ruleTypeRuleTypeType of alert rule
severityAlertSeverityAlert severity level
conditionsJSONRule-specific conditions (event types, actions, resource types)
thresholdCountIntegerEvent count threshold for threshold-based rules
thresholdWindowMinutesIntegerTime window for threshold evaluation (in minutes)
notificationChannelsStringComma-separated channels: email, slack, webhook
notificationRecipientsStringComma-separated emails or webhook URLs
cooldownMinutesIntegerMinimum minutes between repeated alerts
lastTriggeredAtInstantTimestamp of last trigger
triggerCountIntegerTotal number of times the rule has triggered
isActiveBooleanWhether the rule is enabled

Example Alert Rules

Failed Login Threshold

{
  "name": "Multiple Failed Logins",
  "ruleType": "FAILED_AUTH",
  "severity": "HIGH",
  "conditions": {
    "eventTypes": ["LOGIN_FAILED"]
  },
  "thresholdCount": 5,
  "thresholdWindowMinutes": 15,
  "notificationChannels": "email,slack",
  "notificationRecipients": "security@acme.com",
  "cooldownMinutes": 30
}

After-Hours Access

{
  "name": "After Hours Data Access",
  "ruleType": "AFTER_HOURS",
  "severity": "MEDIUM",
  "conditions": {
    "eventTypes": ["DATA_ACCESS", "DATA_EXPORT"],
    "businessHoursStart": "09:00",
    "businessHoursEnd": "18:00",
    "timezone": "America/New_York"
  },
  "notificationChannels": "email",
  "notificationRecipients": "security@acme.com",
  "cooldownMinutes": 60
}

Security Event Match

{
  "name": "Access Denied Alert",
  "ruleType": "EVENT_MATCH",
  "severity": "MEDIUM",
  "conditions": {
    "eventTypes": ["ACCESS_DENIED", "RATE_LIMIT_EXCEEDED"]
  },
  "notificationChannels": "slack,webhook",
  "notificationRecipients": "https://hooks.slack.com/xxx",
  "cooldownMinutes": 15
}

Notification Channels

ChannelDelivery Method
emailSends alert details to the notification recipients via email
slackPosts to a Slack webhook URL
webhookSends a JSON payload to a custom HTTP endpoint

Cooldown Mechanism

The cooldown mechanism prevents alert fatigue by enforcing a minimum interval between repeated triggers of the same rule. When a rule is triggered:

  1. The alert is created and notifications are sent
  2. The lastTriggeredAt timestamp is updated
  3. Subsequent events matching the rule within the cooldownMinutes window are suppressed
  4. After the cooldown expires, the rule can trigger again

Database Indexes

IndexColumnsPurpose
idx_alert_rules_tenanttenant_idEfficient tenant-scoped rule queries
idx_alert_rules_activeis_activeFilter active rules for evaluation