β Now working with CerbiSuite β Fully integrated with CerbiShield scoring, governance dashboards, and end-to-end traceability across all Cerbi logging SDKs.
Real-time logging governance enforcement for Microsoft.Extensions.Logging (MEL) using the Cerbi validation engine.
Cerbi.MEL.Governance is part of the Cerbi suite. It enables runtime validation of log fields based on structured governance profiles. Built for ASP.NET Core, Worker Services, Azure Functions, and any .NET app using Microsoft.Extensions.Logging.
- β Enforce required and forbidden fields
- β Strict mode suppresses raw forbidden values β violating messages are replaced by a redacted governance-annotated JSON payload that never reaches the sink
- β Drop or tag logs with governance violations
- β
Allow relaxed logs (
Relax()mode) - β
Supports structured logging and
BeginScope - β
Supports
[CerbiTopic("...")]profile routing via caller class detection (using injectedCerbiTopicfield) - β Compatible with any MEL-compatible sink (Console, File, Seq, etc.)
- β
Score shipping always fires β fallback scoring (100 β 10 Γ violations, floor 0) applied when
GovernanceScoreImpactis absent
dotnet add package Cerbi.MEL.Governance{
"EnforcementMode": "Strict",
"LoggingProfiles": {
"Orders": {
"FieldSeverities": {
"userId": "Required",
"email": "Required",
"password": "Forbidden"
},
"AllowRelax": true,
"RequireTopic": true,
"AllowedTopics": ["Orders"]
}
}
}Save this as cerbi_governance.json in your project root.
using Microsoft.Extensions.Logging;
using Cerbi.MEL.Governance;
builder.Logging.AddCerbiGovernance(options =>
{
options.Profile = "Orders"; // default fallback
options.ConfigPath = "cerbi_governance.json";
});[CerbiTopic("Orders")]
public class OrderService
{
private readonly ILogger<OrderService> _logger;
public OrderService(ILogger<OrderService> logger)
{
_logger = logger;
}
public void Process()
{
_logger.LogInformation("Order processed for {userId}", "abc123");
}
}β This works via automatic injection of the topic into the log fields. The logger sets the
CerbiTopicfield at runtime if the caller class has the[CerbiTopic("...")]attribute.
logger.LogInformation("User info: {userId} {email}", "abc123", "test@example.com");
// Violates governance (missing userId)
logger.LogInformation("Only email provided: {email}", "test@example.com");
// Forbidden field β in Strict mode the raw message is suppressed;
// a redacted governance JSON payload is emitted instead
logger.LogInformation("Password in log: {userId} {email} {password}", "abc123", "test@example.com", "secret");The original log message passes through unchanged, with an optional governance-annotated JSON side-channel attached.
The original message is suppressed. A redacted JSON payload is emitted to the sink instead, ensuring forbidden field values never leave the application boundary:
{
"userId": "abc123",
"email": "test@example.com",
"GovernanceProfileUsed": "Orders",
"GovernanceViolations": ["ForbiddenField:password"],
"GovernanceRelaxed": false,
"GovernanceMode": "Strict"
}Note: the forbidden field value (password) is absent from the output β it is stripped during redaction.
The MEL governance SDK ships scoring identity metadata with every governance event, enabling end-to-end traceability in CerbiShield dashboards.
| Scenario | Behaviour |
|---|---|
GovernanceScoreImpact present in validated fields |
Used directly |
GovernanceScoreImpact absent (validator did not compute it) |
Computed as max(0, 100 β 10 Γ violationCount) |
| Relaxed log | Score impact forced to 0 |
Score events are always enqueued regardless of enforcement mode, so the portal always receives telemetry even for blocked events.
| Field | Source | Purpose |
|---|---|---|
ServiceName |
CerbiGovernanceMELSettings.ServiceName |
Logical service name (e.g., OrderService) |
AppVersion |
CerbiGovernanceMELSettings.AppVersion |
Deployed version (e.g., 1.2.3) |
InstanceId |
CerbiGovernanceMELSettings.InstanceId |
Container/pod instance identifier |
DeploymentId |
CerbiGovernanceMELSettings.DeploymentId |
Release/deployment tracking ID |
ProfileName |
Governance profile name (topic) | Stamped onto every ViolationDto |
AppName |
CerbiGovernanceMELSettings.AppName |
Stamped onto every ViolationDto |
builder.Logging.AddCerbiGovernance(options =>
{
options.Profile = "Orders";
options.ConfigPath = "cerbi_governance.json";
options.AppName = "OrderService";
options.Environment = "Production";
options.ServiceName = "order-api";
options.AppVersion = "1.2.3";
options.InstanceId = Environment.GetEnvironmentVariable("HOSTNAME");
options.DeploymentId = Environment.GetEnvironmentVariable("DEPLOYMENT_ID");
options.ScoreShipping = new ScoreShippingOptions
{
Enabled = true,
LicenseAllowsScoring = true
};
});All identity fields flow through:
CerbiGovernanceMELSettingsβScoringEventDtoβScoringEnvelopeFactory- Each
ViolationDtois stamped withProfileNameandAppNamefor downstream linkage.
- π CerbiStream β Core logging library
- βοΈ Cerbi.Serilog.Governance
- π§ Cerbi.Governance.Runtime
- π Cerbi Docs