YMJake.Aspire.Hosting.VictoriaLogs 0.1.0-alpha.1

This is a prerelease version of YMJake.Aspire.Hosting.VictoriaLogs.
dotnet add package YMJake.Aspire.Hosting.VictoriaLogs --version 0.1.0-alpha.1
                    
NuGet\Install-Package YMJake.Aspire.Hosting.VictoriaLogs -Version 0.1.0-alpha.1
                    
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="YMJake.Aspire.Hosting.VictoriaLogs" Version="0.1.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YMJake.Aspire.Hosting.VictoriaLogs" Version="0.1.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="YMJake.Aspire.Hosting.VictoriaLogs" />
                    
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 YMJake.Aspire.Hosting.VictoriaLogs --version 0.1.0-alpha.1
                    
#r "nuget: YMJake.Aspire.Hosting.VictoriaLogs, 0.1.0-alpha.1"
                    
#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 YMJake.Aspire.Hosting.VictoriaLogs@0.1.0-alpha.1
                    
#: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=YMJake.Aspire.Hosting.VictoriaLogs&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=YMJake.Aspire.Hosting.VictoriaLogs&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Tool

Aspire.Hosting.VictoriaLogs

VictoriaLogs hosting integration for .NET Aspire.

dotnet add package YMJake.Aspire.Hosting.VictoriaLogs

VictoriaLogs is a single-binary log database from the VictoriaMetrics project: it stores logs, exposes an HTTP insert API on several protocols, and serves queries through LogsQL. This package models one single-node container as one Aspire resource.

vlogs
└── victoriametrics/victoria-logs:v1.53.0  (http endpoint -> 9428)

Usage

IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args);

IResourceBuilder<VictoriaLogsResource> vlogs = builder.AddVictoriaLogs("vlogs");

builder.AddProject<Projects.Api>("api")
    .WithReference(vlogs);

await builder.Build().RunAsync();

By default, the integration creates:

  • a victoriametrics/victoria-logs container
  • an HTTP endpoint on http://localhost:9428 (a random host port when port is omitted)
  • --storageDataPath=/vlogs and --retentionPeriod=7d
  • a /health health check
  • a dashboard link that opens the built-in UI at /select/vmui/

Connection string

WithReference(vlogs) injects ConnectionStrings__vlogs with the base URL of the instance, for example http://localhost:9428. Container-to-container consumers get the container network address instead of localhost.

The connection string is the base URL only. Each client appends its own path:

Protocol Path
JSON line /insert/jsonline
Elasticsearch bulk /insert/elasticsearch/_bulk
Loki push /insert/loki/api/v1/push
OpenTelemetry (OTLP/HTTP) /insert/opentelemetry/v1/logs
LogsQL query /select/logsql/query
Web UI /select/vmui/

OpenTelemetry logs

For .NET services, reference the Aspire.VictoriaLogs client package and call AddVictoriaLogsEndpoint with the same connection name. It reads ConnectionStrings:vlogs, so the URL never appears in code:

// Api
builder.AddVictoriaLogsEndpoint("vlogs");

Only the log signal is redirected; traces and metrics keep flowing to the Aspire dashboard.

WithLogsExporter is the AppHost-side alternative for resources that are not .NET, or that already configure their OTLP exporter from environment variables:

builder.AddProject<Projects.Api>("api")
    .WithLogsExporter(vlogs);

It sets only OTEL_EXPORTER_OTLP_LOGS_ENDPOINT (to <base>/insert/opentelemetry/v1/logs) and OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf.

The full signal path is required in both cases: the .NET OTLP exporter uses OTEL_EXPORTER_OTLP_LOGS_ENDPOINT verbatim and only appends v1/logs to the generic OTEL_EXPORTER_OTLP_ENDPOINT.

Retention and persistence

The retention window defaults to 7d and is enforced by VictoriaLogs itself. The minimum supported value is 1d.

builder.AddVictoriaLogs("vlogs", retentionPeriod: "30d");

Data is ephemeral by default. Persist it explicitly:

builder.AddVictoriaLogs("vlogs")
    .WithDataVolume();              // auto-generated volume name

builder.AddVictoriaLogs("vlogs")
    .WithDataVolume("vlogs-data");  // explicit volume name

builder.AddVictoriaLogs("vlogs")
    .WithDataBindMount("./data/vlogs");

Querying

The web UI is available at http://localhost:9428/select/vmui/. LogsQL queries can also be issued over HTTP:

curl 'http://localhost:9428/select/logsql/query' --data-urlencode 'query=_time:5m "hello"'

LogsQL treats bare words as filters and - as negation, so quote phrases that contain hyphens.

Notes

  • Only the single-node image is supported. Cluster mode (vlinsert/vlselect/vlstorage) is out of scope.
  • VictoriaLogs has no authentication of its own. Keep the endpoint on localhost, or put a proxy in front of it for shared environments.
  • The container listens on 9428 and needs no configuration beyond the data path and retention.
Product Compatible and additional computed target framework versions.
.NET 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.

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
0.1.0-alpha.1 60 10/31/2026