pinqloq 4.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package pinqloq --version 4.0.2
                    
NuGet\Install-Package pinqloq -Version 4.0.2
                    
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="pinqloq" Version="4.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="pinqloq" Version="4.0.2" />
                    
Directory.Packages.props
<PackageReference Include="pinqloq" />
                    
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 pinqloq --version 4.0.2
                    
#r "nuget: pinqloq, 4.0.2"
                    
#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 pinqloq@4.0.2
                    
#: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=pinqloq&version=4.0.2
                    
Install as a Cake Addin
#tool nuget:?package=pinqloq&version=4.0.2
                    
Install as a Cake Tool

Pinqloq

NuGet Downloads License: MIT

Pinqloq is an ASP.NET Core structured logging and log shipping SDK for centralized application logs. It captures HTTP request/response logs through middleware and sends manual application events to the Pinqloq log management platform using in-memory buffering, batching, and HTTPS delivery.

Features

  • Automatic ASP.NET Core request logging
  • Manual structured application events
  • Buffered and batched HTTPS delivery
  • No customer-managed message broker or token refresh flow
  • Graceful shutdown flush

Requirements

  • .NET 8.0 or later
  • A Pinqloq project and secret key

Installation

dotnet add package pinqloq

Quick Start

Store your secret key in configuration, an environment variable, or a secret manager. Do not hardcode production credentials.

{
  "Pinqloq": {
    "SecretKey": "your-secret-key",
    "ApiLogsCollectionName": "myapp_api_logs",
    "Identifier": "myapp-instance-1"
  }
}

Register Pinqloq and enable automatic request logging:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddPinqloq(options =>
{
    options.SecretKey =
        builder.Configuration["Pinqloq:SecretKey"]
        ?? throw new InvalidOperationException("Pinqloq secret key is missing.");

    options.ApiLogsCollectionName =
        builder.Configuration["Pinqloq:ApiLogsCollectionName"];

    options.Identifier =
        builder.Configuration["Pinqloq:Identifier"];
});

var app = builder.Build();

app.UsePinqloqRequestLogging(options =>
{
    options.ExcludePaths("/health", "/swagger");
});

app.MapControllers();
app.Run();

The middleware captures the HTTP method, path, status code, request body, and response body. Bodies are truncated at 32 KB.

Manual Logging

Inject IPinqloqLogger to send structured application events:

public class OrderService(IPinqloqLogger logger)
{
    public void CreateOrder(Order order)
    {
        logger.Enqueue(new PinqloqLogEntry
        {
            Event = "order.created",
            Identifier = order.CustomerId.ToString(),
            LogLevel = PinqloqLogLevel.Information,
            LogSourceType = PinqloqLogSourceType.Backend,
            Metadata = new()
            {
                ["orderId"] = order.Id.ToString()
            }
        });
    }
}

Event and Identifier are required on every entry. Event is used as the log title; both are created automatically by the request-logging middleware. Leave Identifier unset on an entry to inherit the global PinqloqOptions.Identifier. Enqueue throws an InvalidOperationException if an entry has no Identifier and no global PinqloqOptions.Identifier is set — a missing required field fails loudly rather than being silently dropped.

Add Request Metadata

By default the middleware reads the required Identifier from the identifier request header automatically — no configuration needed as long as callers send that header. Override how it is resolved with SetIdentifier (a claim, trace id, a different header, …); the override wins, and if it returns null/empty the middleware falls back to the identifier header, then to the global PinqloqOptions.Identifier. If none of these resolve a value, the middleware rejects the request with HTTP 400 before it runs (rather than silently dropping the log).

To attach searchable request metadata, replace the middleware call from Quick Start with the following configuration. Use AddMetadata for searchable values such as user, tenant, and correlation IDs. Use AddDetail for additional drill-down information. The event key (the panel title) defaults to "{method} {path}" and can be overridden with AddMetadata("event", …).

app.UsePinqloqRequestLogging(options =>
{
    options.ExcludePaths("/health", "/swagger");

    options.SetIdentifier(context =>
        context.User.FindFirst("sub")?.Value);

    options.SetAppVersionName(context =>
        context.Request.Headers["X-App-Version"].ToString());

    options.AddMetadata("userId", context =>
        context.User.FindFirst("sub")?.Value);

    options.AddMetadata("correlationId", context =>
        context.TraceIdentifier);
});

Security and Reliability

Request and response bodies may contain credentials, tokens, personal information, or other sensitive data. Exclude sensitive endpoints before enabling body logging in production.

Logs are buffered in memory and sent in batches. Buffered logs may be lost if the process is terminated without a graceful shutdown.

Delivery failures are reported through onFailed callbacks and, even without callbacks, as throttled entries in your application log — never silently discarded, but also never blocking. If your secret key is authorized for more than one collection, set ApiLogsCollectionName (or a per-entry CollectionName); otherwise the batch is rejected.

Documentation

License

MIT

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 is compatible.  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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on pinqloq:

Package Downloads
Pinqponq.Observability

Pinqloq logging for ASP.NET Core: one structured record per request (redacted request/response bodies, route-based event names, error detail from Pinqponq.ErrorHandling), and an ILogService for application and job logs with stack trace trimming.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.3.2 403 9/14/2026
4.3.1 132 9/9/2026
4.3.0 1,838 9/8/2026
4.2.0 559 9/1/2026
4.1.0 234 8/25/2026
4.0.3 266 8/6/2026
4.0.2 352 7/22/2026
4.0.1 138 7/21/2026
4.0.0 133 7/20/2026
3.0.0 140 7/14/2026
2.0.8 168 7/14/2026
2.0.7 291 7/6/2026
2.0.6 126 7/6/2026
2.0.5 197 7/6/2026
2.0.4 138 7/6/2026
2.0.3 188 7/2/2026
2.0.2 137 7/2/2026
2.0.1 148 7/1/2026
2.0.0 222 6/23/2026
1.0.2 142 6/19/2026
Loading failed

5.0.0 BREAKING: a missing Identifier now fails loudly instead of being silently dropped. The request-logging middleware resolves Identifier as SetIdentifier -> "identifier" header -> PinqloqOptions.Identifier and, if none yield a value, rejects the request with HTTP 400. Manual Enqueue throws InvalidOperationException when the entry has no Identifier and no global fallback is set. Guarantee a value with SetIdentifier(ctx => ctx.Request.Headers["identifier"].FirstOrDefault() ?? Environment.MachineName) or PinqloqOptions.Identifier. 4.0.1: AppVersionName sent as null (not "") when unset. 4.0.0 BREAKING: DeviceUid renamed to Identifier and made required — the ingest API rejects logs with an empty Identifier (single log to 400, batch entry skipped). Populate it per log via PinqloqLogEntry.Identifier, globally via PinqloqOptions.Identifier, or per request. The request-logging middleware now reads the "identifier" request header automatically; SetIdentifier overrides it and falls back to the header then to PinqloqOptions.Identifier. Also adds SetAppVersionName to override AppVersionName per request. The package now multi-targets net8.0, net9.0, and net10.0 (previously net9.0 only).