CerbiStream 1.1.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package CerbiStream --version 1.1.14
                    
NuGet\Install-Package CerbiStream -Version 1.1.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CerbiStream" Version="1.1.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CerbiStream" Version="1.1.14" />
                    
Directory.Packages.props
<PackageReference Include="CerbiStream" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CerbiStream --version 1.1.14
                    
#r "nuget: CerbiStream, 1.1.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CerbiStream&version=1.1.14
                    
Install as a Cake Addin
#tool nuget:?package=CerbiStream&version=1.1.14
                    
Install as a Cake Tool

CerbiStream: Dev-Friendly, Governance-Enforced Logging for .NET

Brought to you by Cerbi LLC, your trusted partner in enterprise observability.

πŸš€ View CerbiStream Benchmarks
Compare against Serilog, NLog, and others. CerbiStream is engineered for high performance, strict governance, and enterprise-grade log routing.

CerbiStream NuGet CerbiStream Downloads Governance Analyzer NuGet Governance Analyzer Downloads Build Status Quality Gate Status

Benchmark Tests Repo License: MIT

πŸ”— Where can CerbiStream connect? CerbiStream natively supports:

  • πŸ“¨ Queues: Azure Service Bus, RabbitMQ, Kafka, AWS SQS/Kinesis, Google Pub/Sub
  • 🌐 HTTP Endpoints: Send logs to any REST API with custom headers
  • ☁️ Cloud Storage: Azure Blob Storage (save structured logs for batch processing)
  • πŸ“ File System Fallback: Encrypted JSON file logging when needed
  • πŸ“ˆ Telemetry Providers: App Insights, OpenTelemetry, Datadog, AWS CloudWatch, GCP Stackdriver

Table of Contents


πŸ”„ Recent Updates (v1.1.2)

New Features

  • Unified Log Enrichment: Every log is decorated with a LogId, TimestampUtc, ApplicationId, InstanceId, CloudProvider, Region, plus any user metadata.
  • Payload Encryption: When EncryptionMode is set (Base64/AES) and encryption is enabled, the full JSON payload is encrypted before sending. A debug entry logs:
    _logger.LogDebug($"[CerbiStream] Payload for log ID {logId} encrypted ({options.EncryptionMode}).");
    
  • Metadata Injection: With EnableMetadataInjection, every call automatically adds timestamp, log level, and (optionally) encrypts sensitive metadata fields (APIKey, SensitiveField, etc.).
  • Governance Hook: Before sending, options.ValidateLog(profileName, metadata) runs any configured governance validator; failures drop the log with an error.
  • New Backends Added: Out-of-the-box support now includes HTTP endpoint (HttpMessageSender) and Azure Blob Storage (BlobStorageSender)β€”a highlight of v1.1.2!

Developer Quick Start

πŸ‘‰ View Quick Start Guide

Advanced Setup & Best Practices

πŸ‘‰ View Advanced Setup Guide

Overview

CerbiStream is a high-performance, dev-friendly logging framework for .NET that enforces structured logging governance and flexible encryption. It integrates seamlessly with ILogger<T> and supports a variety of backends.


Highlights

  • High Throughput: Async, queue‑first architecture minimizes latency.
  • Governance Enforced: Schema and field validation via pluggable validators.
  • Encryption Options: Base64 or AES encrypt entire JSON payloads.
  • Telemetry Integration: Forward events/exceptions/dependencies to App Insights, Datadog, etc.
  • Fallback Logging: Optional encrypted file rotation when queues or endpoints are unavailable.

Features

  • Preset Modes:

    • EnableDevModeMinimal() β€” Console only, no metadata/governance.
    • EnableDeveloperModeWithoutTelemetry() β€” Metadata injected, no telemetry.
    • EnableDeveloperModeWithTelemetry() β€” Full metadata + telemetry.
    • EnableBenchmarkMode() β€” Silent/benchmark mode.
  • Advanced Metadata Injection:

    • Automatic TimestampUtc, LogLevel, plus any custom fields.
    • Conditional encryption of sensitive fields.
  • Payload Encryption:

    • EncryptionType.Base64 or AES with configurable key/IV.
    • Debug logs show encryption actions.
  • Transport Agnostic:

    • Queues: RabbitMQ, Kafka, Azure Service Bus, AWS SQS/Kinesis, Google Pub/Sub.
    • HTTP: Post JSON logs to any REST endpoint.
    • Azure Blob: Store logs as blobs for later processing.
  • Polly Retries:

    • Transparent retry logic for transient failures.
  • Governance Validator:

    • Drop or enrich messages based on organizational policies.

Advanced Metadata & Encryption

Metadata Injection

Enable or disable via:

options.WithMetadataInjection(true);

When enabled, logs include:

  • TimestampUtc (UTC time)
  • LogLevel (string)
  • Any custom metadata you supply.

Payload Encryption

Configure in CerbiStreamOptions:

options.WithEncryptionMode(EncryptionType.AES)
       .WithEncryptionKey(myKeyBytes, myIvBytes);

When enabled, the entire JSON payload is encrypted before transport, and a debug log indicates this.

Before Encryption
{
  "LogId": "abc123",
  "LogData": { /* your log entry */ }
}
After Encryption
[ENCRYPTED]<base64-or-aes-payload>[/ENCRYPTED]

Usage Examples

By Environment

Development
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddCerbiStream(opts => opts.EnableDevModeMinimal());
var app = builder.Build();
app.Run();
Production
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddCerbiStream(opts => {
    opts.WithQueue("RabbitMQ", "amqp://localhost", "logs-queue")
        .WithEncryptionMode(EncryptionType.Base64)
        .WithMetadataInjection(true)
        .EnableDeveloperModeWithoutTelemetry();
});

By Transport

Queues
builder.Logging.AddCerbiStream(opts => {
    opts.WithQueue("AzureServiceBus", connectionString, "my-logs")
        .WithEncryptionMode(EncryptionType.AES)
        .WithEncryptionKey(key, iv)
        .WithTelemetryProvider(
            TelemetryProviderFactory.CreateTelemetryProvider("appinsights")
        )
        .WithGovernanceValidator((profile, md) => md.ContainsKey("UserId"))
        .EnableDeveloperModeWithTelemetry();
});
HTTP
builder.Services.AddSingleton<ISendMessage>(
    new HttpMessageSender("https://logs.myservice.com/ingest", new Dictionary<string,string>{{"x-api-key","secret"}})
);
Blob Storage
builder.Services.AddSingleton<ISendMessage>(
    new BlobStorageSender(connectionString, "logs-container")
);
Merged Performance & Exception
var metadata = new Dictionary<string, object> {
    ["ElapsedMilliseconds"] = 200,
    ["DependencyCommand"]  = "POST /api/order",
    ["ExceptionMessage"]   = ex.Message
};
await logger.LogEventAsync("OrderError", LogLevel.Error, metadata);

Integration & Supported Platforms

Queues: RabbitMQ, Kafka, Azure Service Bus, AWS SQS/Kinesis, Google Pub/Sub.
HTTP Endpoint: Any RESTful API.
Azure Blob Storage: Append logs as JSON blobs.

Auto‑Detect Cloud Metadata: CerbiStream inspects these environment variables:

  • AWS_EXECUTION_ENV β†’ AWS
  • GOOGLE_CLOUD_PROJECT β†’ GCP
  • WEBSITE_SITE_NAME β†’ Azure

These populate CloudProvider and Region metadata fields.


Governance and Compliance

  • Pluggable Validator: options.WithGovernanceValidator(...) to enforce fields.
  • Static Analysis: Use CerbiStream.GovernanceAnalyzer in your CI:
    # .github/workflows/governance.yml
    name: Governance Validation
    on: [push, pull_request]
    jobs:
      validate-logs:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - name: Install Analyzer
            run: dotnet tool install -g CerbiStream.GovernanceAnalyzer
          - name: Run Analyzer
            run: cerbi-governance analyze --config cerbi_governance.json
    
  • Azure Marketplace Dashboard: Coming soon – visualize governance metrics in CerbiStream dashboard.

Telemetry Provider Support

Provider Activation
OpenTelemetry CreateTelemetryProvider("opentelemetry")
App Insights CreateTelemetryProvider("appinsights")
AWS CloudWatch CreateTelemetryProvider("awscloudwatch")
Datadog CreateTelemetryProvider("datadog")
GCP Stackdriver CreateTelemetryProvider("gcpstackdriver")

Unit Testing

Comprehensive coverage for:

  • Payload encryption
  • Metadata injection
  • Retry logic
  • Governance validation
  • File fallback rotation

Benchmark vs Serilog

CerbiStream was benchmarked against Serilog to highlight performance, memory usage, and enterprise-readiness.

Category CerbiStream Serilog Comments
Pipeline Layers Serialize β†’ Encrypt β†’ Send Destructure βž” Enrich βž” Filter βž” Format βž” Write Serilog's architecture adds overhead per log event.
Memory Allocation per Event πŸ”΅ ~1–3 KB πŸ”΄ ~10–30 KB Serilog allocates multiple objects (LogEventProperty trees).
Encryption Model Encrypt entire payload No built-in encryption CerbiStream secures the full log payload without external libraries.
Throughput 🟒 >50K logs/sec 🟠 ~10K–30K logs/sec CerbiStream maintains speed even with encryption and governance.
Telemetry & Governance Native, lightweight, optional enforcement Plugins required, no native governance CerbiStream enforces compliance simply.

Why CerbiStream is Faster

  • No Multi-Step Enrichers: Metadata is injected once during serialization.
  • Full-Payload Encryption: Encrypts the JSON payload, avoiding per-field cost.
  • Minimal Object Allocation: No construction of complex LogEvent trees.
  • Light Retry Strategy: Built-in Polly retries for resilient delivery.

When to Choose CerbiStream

Enterprise-Grade Systems Lightweight Applications
CerbiStream βœ… Best choice (performance, compliance, encryption) βœ… Simple setup, lower resource usage
Serilog βš™οΈ Possible, but heavier and harder to govern βœ… Best for flexible, custom plug-in scenarios

View the full benchmarks: CerbiStream Benchmark Tests


License

MIT Β© Cerbi LLC


Contributing

PRs and issues welcome! Please ensure tests pass and follow style guidelines. Use git tag to list releases.


Community & Support


License

MIT Β© Cerbi LLC

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.19 0 7/4/2025
1.1.18 138 5/20/2025
1.1.17 136 5/20/2025
1.1.16 139 5/20/2025
1.1.15 97 5/18/2025
1.1.14 219 5/15/2025
1.1.13 216 5/14/2025
1.1.12 226 5/14/2025
1.1.11 218 5/14/2025
1.1.10 221 5/14/2025
1.1.9 224 5/13/2025
1.1.8 235 5/13/2025
1.1.7 137 5/6/2025
1.1.6 159 4/27/2025
1.1.5 150 4/27/2025
1.1.3 127 4/27/2025
1.1.2 142 4/25/2025
1.1.1 181 4/13/2025
1.1.0 177 4/13/2025
1.0.16 140 4/10/2025
1.0.15 141 4/7/2025
1.0.14 93 4/6/2025
1.0.13 117 3/28/2025
1.0.12 109 3/27/2025
1.0.11 445 3/26/2025
1.0.10 466 3/25/2025
1.0.9 135 3/23/2025
1.0.8 53 3/22/2025
1.0.7 114 3/21/2025
1.0.6 126 3/20/2025
1.0.5 131 3/20/2025
1.0.4 121 3/19/2025
1.0.3 123 3/19/2025
1.0.2 141 3/12/2025
1.0.1 133 3/12/2025