VOOZH about

URL: https://www.nuget.org/packages/TAF.Kibana.SDK/

⇱ NuGet Gallery | TAF.Kibana.SDK 1.4.6




TAF.Kibana.SDK 1.4.6

dotnet add package TAF.Kibana.SDK --version 1.4.6
 
 
NuGet\Install-Package TAF.Kibana.SDK -Version 1.4.6
 
 
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="TAF.Kibana.SDK" Version="1.4.6" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TAF.Kibana.SDK" Version="1.4.6" />
 
Directory.Packages.props
<PackageReference Include="TAF.Kibana.SDK" />
 
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 TAF.Kibana.SDK --version 1.4.6
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TAF.Kibana.SDK, 1.4.6"
 
 
#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.
#:package TAF.Kibana.SDK@1.4.6
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TAF.Kibana.SDK&version=1.4.6
 
Install as a Cake Addin
#tool nuget:?package=TAF.Kibana.SDK&version=1.4.6
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

TAF Kibana SDK

Official .NET SDK for TAF Kibana logging and analytics platform. Provides a fluent API for log management, searching, metrics, and real-time monitoring.

Installation

dotnet add package TAF.Kibana.SDK

Quick Start

Configuration

Add to your appsettings.json:

{
 "KibanaClient": {
 "BaseUrl": "https://your-kibana-instance.com/api",
 "ApiKey": "your-api-key",
 "TimeoutSeconds": 30,
 "MaxRetryAttempts": 3,
 "BulkBatchSize": 1000
 }
}

Dependency Injection

using TAF.Kibana.SDK.Extensions;

// In Program.cs or Startup.cs
services.AddTafKibanaClient(Configuration);

// Or with inline configuration
services.AddTafKibanaClient(options =>
{
 options.BaseUrl = "https://your-kibana-instance.com/api";
 options.ApiKey = "your-api-key";
});

Usage Examples

Basic Usage

public class LoggingService
{
 private readonly ITafKibanaClient _kibanaClient;

 public LoggingService(ITafKibanaClient kibanaClient)
 {
 _kibanaClient = kibanaClient;
 }

 public async Task LogEventAsync()
 {
 // Write a log entry
 await _kibanaClient.Logs.WriteAsync(new LogEntry
 {
 Level = "Information",
 Message = "User logged in",
 TenantId = tenantId,
 ApplicationId = appId
 });
 }
}

Fluent Search API

// Search for error logs in the last 24 hours
var results = await _kibanaClient.Query()
 .ForTenant(tenantId)
 .InLastHours(24)
 .WithLogLevel("Error", "Critical")
 .ContainingText("database connection")
 .OrderBy(x => x.Timestamp, SortDirection.Descending)
 .Take(100)
 .ExecuteAsync<LogEntry>();

// Stream large result sets
await foreach (var log in _kibanaClient.Query()
 .ForTenant(tenantId)
 .InDateRange(startDate, endDate)
 .StreamAsync<LogEntry>())
{
 ProcessLog(log);
}

Aggregations and Analytics

// Get log statistics with aggregations
var stats = await _kibanaClient.Query()
 .ForTenant(tenantId)
 .InLastDays(7)
 .WithAggregation(agg => agg
 .Terms("by_level", "level", size: 10)
 .DateHistogram("over_time", "timestamp", "1h")
 .Average("avg_response", "responseTime"))
 .ExecuteAsync<LogEntry>();

// Get metrics
var metrics = await _kibanaClient.Metrics.GetTimeSeriesAsync(
 metric: "response_time",
 from: DateTime.UtcNow.AddDays(-7),
 to: DateTime.UtcNow,
 interval: "1h");

Bulk Operations

// Bulk indexing with fluent API
var result = await _kibanaClient.Bulk()
 .IndexMany(logEntries)
 .WithBatchSize(500)
 .ContinueOnError(true)
 .WithRefresh(RefreshPolicy.WaitFor)
 .ExecuteAsync();

Console.WriteLine($"Indexed {result.SuccessfulOperations} of {result.TotalOperations} documents");

Real-time Monitoring

// Subscribe to real-time log stream
var subscription = await _kibanaClient.Realtime.SubscribeToLogsAsync(
 filter: query => query
 .ForTenant(tenantId)
 .WithLogLevel("Error"),
 onEvent: logEvent =>
 {
 Console.WriteLine($"New error: {logEvent.Message}");
 });

// Tail logs
await foreach (var log in _kibanaClient.Realtime.TailLogsAsync(
 filter: q => q.ForTenant(tenantId),
 initialLines: 100))
{
 Console.WriteLine($"[{log.Timestamp}] {log.Level}: {log.Message}");
}

Alert Management

// Create alert rule
var rule = await _kibanaClient.Alerts.CreateRuleAsync(new AlertRuleDefinition
{
 Name = "High Error Rate",
 Description = "Alert when error rate exceeds threshold",
 TenantId = tenantId,
 Severity = AlertSeverity.High,
 CheckInterval = TimeSpan.FromMinutes(5),
 Condition = new AlertCondition
 {
 Type = AlertConditionType.Query,
 Query = q => q.WithLogLevel("Error"),
 Operator = ComparisonOperator.GreaterThan,
 Threshold = 100,
 TimeWindow = TimeSpan.FromMinutes(5)
 },
 NotificationChannels = new[] { "email", "slack" }
});

// Get alert history
var alerts = await _kibanaClient.Alerts.GetAlertHistoryAsync(
 ruleId: rule.Id,
 from: DateTime.UtcNow.AddDays(-7));

Advanced Queries

// Complex field queries with expressions
var results = await _kibanaClient.Query()
 .ForTenant(tenantId)
 .Where<LogEntry>(x => x.Level == "Error" && x.ResponseTime > 1000)
 .WhereField("environment", SearchOperator.In, new[] { "production", "staging" })
 .WhereField("statusCode", SearchOperator.Between, new { from = 400, to = 599 })
 .WithHighlighting("message", "stackTrace")
 .WithCaching(TimeSpan.FromMinutes(5))
 .ExecuteAsync<LogEntry>();

// Export search results
var export = await _kibanaClient.Search.ExportAsync(
 request: queryBuilder.Build(),
 format: ExportFormat.Csv);

File.WriteAllBytes("logs.csv", export.Data);

Features

  • Fluent API: Intuitive query building with IntelliSense support
  • Resilience: Built-in retry policies and circuit breaker patterns
  • Streaming: IAsyncEnumerable support for processing large datasets
  • Real-time: WebSocket-based real-time log streaming and monitoring
  • Bulk Operations: Efficient bulk indexing with progress tracking
  • Caching: Query result caching for improved performance
  • Type Safety: Strongly-typed API with generic support
  • Compression: Automatic request/response compression
  • Health Checks: Built-in health check support

Configuration Options

Option Description Default
BaseUrl Kibana API base URL https://localhost:44356/
ApiKey API key for authentication -
TimeoutSeconds Request timeout in seconds 30
MaxRetryAttempts Maximum retry attempts 3
RetryDelayMilliseconds Delay between retries 1000
EnableLogging Enable debug logging false
BulkBatchSize Batch size for bulk operations 1000
EnableCompression Enable request compression true
CircuitBreakerThreshold Circuit breaker threshold 5
CircuitBreakerTimeoutSeconds Circuit breaker timeout 60

Advanced Configuration

Custom HTTP Client

services.AddTafKibanaClientWithCustomHttp(
 options => options.BaseUrl = "https://api.example.com",
 httpBuilder => httpBuilder
 .AddHttpMessageHandler<CustomAuthHandler>()
 .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
 {
 Proxy = new WebProxy("http://proxy:8080")
 }));

With Health Checks

services.AddTafKibanaClientWithHealthChecks(Configuration);

// In health check endpoint
app.MapHealthChecks("/health", new HealthCheckOptions
{
 ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});

License

MIT

Support

For issues and feature requests, please contact the TechAppForce development team.

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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 (1)

Showing the top 1 NuGet packages that depend on TAF.Kibana.SDK:

Package Downloads
TAF.Kibana.SDK.Serilog

Serilog sink that ships log events to TAF Kibana via the TAF.Kibana.SDK. Version 1.5.5 closes a gap where HttpRequestAuditMiddleware audit docs were silently dropped when Kibana was down. RequestAuditEmitter now appends the LogEntry to the shared IDiskBuffer on WriteAsync failure (or exception) — the sink's existing drain loop replays the doc once Kibana is reachable again. Buffer dependency is optional: the emitter falls back to a LogWarning if IDiskBuffer is not registered (i.e. AddTafHttpRequestAudit used without AddTafKibanaSerilog). Version 1.5.4 merges dev-branch DiskBuffer hardening into the 1.5.x audit-middleware lineage: DrainAsync now tracks attempts in an in-memory dictionary keyed by line content (instead of a counter persisted on each BufferedBatch) so eviction-during-drain no longer resurrects evicted lines from a stale snapshot, the write-back step re-reads the current file under the gate, and the per-line poison cap (KibanaSinkDefaults.MaxBufferReplayAttempts = 5) drops permanently-rejected payloads after the threshold. Attempt counters are pruned at the end of each drain to bound memory growth. The 1.5.x feature surface (audit middleware, IRequestSnapshotBuilder/IRequestAuditEmitter split, IBusContextProvider, HttpLoggingEnricherMiddleware) is preserved. Version 1.5.3 cleans up the audit feature internals — splits HttpRequestAuditMiddleware into IRequestSnapshotBuilder (HTTP context interpretation) and IRequestAuditEmitter (Kibana dispatch), with payload-to-LogEntry mapping in RequestAuditLogEntryMapper. Adds CorrelationId to audit doc Properties (read from X-Correlation-ID response header). Now uses IBusContextProvider for BusContext resolution (DIP). Version 1.5.1 added HttpRequestAuditMiddleware: emits ONE audit document per HTTP request directly via IKibanaClient.Logs.WriteAsync, bypassing Serilog so request body, response body, query string, status code, and elapsed time land in the same ES document. Register with AddTafHttpRequestAudit / UseTafHttpRequestAudit. The original HttpLoggingEnricherMiddleware remains for LogContext enrichment of internal trace logs. Version 1.4.0 added HttpLoggingEnricherMiddleware that captures the HTTP query string, request body, and response body as Serilog properties. Includes a RedactResponseBody hook so consumers can drop heavy fields from read-style responses (e.g. CRUD's /select empties the top-level result array before logging). Provides batched delivery, disk-buffer resilience, secret scrubbing, and BusContext-aware tenant routing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.6 361 5/14/2026
1.2.5 133 5/8/2026
1.2.3 207 5/5/2026
1.1.4 427 1/10/2026
1.1.3 137 1/9/2026
1.1.2 133 1/5/2026
1.1.1 158 1/2/2026
1.1.0 361 9/18/2025
1.0.0 207 9/5/2025