How to run Flare standalone (without .NET Aspire)
Run Flare as its own thing — not tied into another app's .NET Aspire
AppHost. If your app already has an AppHost, see
run-with-aspire.md instead; that's the easier path
when it applies. For a from-scratch guided walkthrough, see
the tutorial first.
Want a standing instance you start once and point many unrelated local
projects' OTLP output at, instead of a repo-local checkout?
flare, a global CLI (dotnet tool install --global Flare.Cli), wraps this same stack as flare start/stop/status/
open/... from anywhere, no git clone needed. Read on if you'd rather
run the stack directly.
Prerequisites
Docker (or another Docker-compatible engine) running — Flare's
Flare.Ingest/Flare.Api/Flare.Dashboard are only distributed as Docker
images, and ClickHouse/Redis themselves run as containers too. There's no
non-Docker install path.
Zero-prerequisite quick install
Just evaluating Flare and don't have this repo cloned, or even a .NET SDK installed? Run:
curl -fsSL https://raw.githubusercontent.com/aminparsa18/Flare.Net/main/scripts/install.sh | bash
This installs Docker itself if it's missing (via
Docker's official convenience script on Linux, or
Homebrew on macOS), then fetches just what's needed to run the stack —
docker-compose.install.yml, the
same compose file below but pulling the Flare images from Docker Hub
instead of building them, since there's no local source to build — into
~/.flare (override with FLARE_INSTALL_DIR), and starts it. Safe to
re-run: it never touches an existing .env or your data volumes, only
re-pulls the compose file/migrations and the latest images. See the
script's own header comment
(scripts/install.sh) for every env var it
reads and exactly what it does.
FLARE_IMAGE_TAG picks the image tag (default latest). The compose file
runs the ClickHouse migrations in a one-shot clickhouse-migrate service,
which needs Flare 0.7.0 or later. For an older release, such as
FLARE_IMAGE_TAG=0.6.0, the script fetches the files from that release's git
tag (v0.6.0) instead, which migrate at service startup. Set
FLARE_INSTALL_REF yourself to choose the ref. If you edit the tag in
~/.flare/.env by hand and run docker compose yourself, keep it at 0.7.0 or
later, or edge.
Prefer to clone the repo yourself (e.g. to build from source, or review the compose file first)? Skip ahead to Start Flare below.
Start Flare
git clone https://github.com/aminparsa18/Flare.Net.git
cd Flare.Net
docker compose up
docker-compose.yml, at the root of this repo, brings up the whole stack —
ClickHouse, Redis, the OTLP receiver, the query API, and the dashboard —
with working defaults for every port and credential. Copy
.env.example to .env first if you need to change
any of the defaults (e.g. a port is already taken on your machine).
Once it's up:
- Dashboard: http://localhost:7777 — open, no
login required, until you turn sign-in on yourself from the
/authpage. Seeconfigure-authentication.md. - OTLP receiver: gRPC on
:4317, HTTP on:4318— what you point your logger at below. Anonymous by default; seeconfigure-authentication.md#ingest-api-keysto require an API key instead.
Need ClickHouse to survive a node dying, or to scale beyond one box? See
run-cluster-mode.md.
Point your logger at it
Every logger below reaches Flare through the same protocol — OTLP — so they all converge on the same two ports. Which one you follow depends only on what you're already using; none of them talks to any of the others or to Flare-specific code, and nothing here needs Flare-specific packages.
Every snippet defaults to gRPC on :4317, matching each library's own
default. All four were run against a real docker compose up stack while
writing this, not just checked against the library's docs — pinned package
versions that were confirmed working are in
../reference/otlp-logger-versions.md.
Microsoft.Extensions.Logging (native — ILogger, no bridge)
dotnet add package OpenTelemetry.Extensions.Hosting --version 1.20.1
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol --version 1.20.1
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
var builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});
builder.Services.AddOpenTelemetry().UseOtlpExporter();
UseOtlpExporter() (no arguments) reads the endpoint from the standard
OTEL_EXPORTER_OTLP_ENDPOINT environment variable, and the service name —
the ServiceName column you'll filter by in the dashboard — from
OTEL_SERVICE_NAME:
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_SERVICE_NAME=my-service
Then log as usual — ILogger<T> calls now reach Flare with zero extra
code at the call site:
logger.LogInformation("hello from {ServiceName}", "my-service");
This is exactly what Flare.ServiceDefaults
itself does — Flare's own services emit their logs this same way.
ZLogger (built directly on ILogger — same OTel pipeline, zero bridge)
Identical wiring to native Microsoft.Extensions.Logging above (same two
OpenTelemetry packages, same environment variables) — add ZLogger as one
more logging provider alongside it, not instead of it:
dotnet add package OpenTelemetry.Extensions.Hosting --version 1.20.1
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol --version 1.20.1
dotnet add package ZLogger --version 2.5.10
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using ZLogger;
var builder = Host.CreateApplicationBuilder(args);
// Your existing ZLogger sink(s) - console, file, whatever you already use.
builder.Logging.AddZLoggerConsole();
// Same OpenTelemetry wiring as the native MEL snippet above.
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});
builder.Services.AddOpenTelemetry().UseOtlpExporter();
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_SERVICE_NAME=my-service
Every logger.ZLog* call now goes to both providers - your existing
ZLogger sink and Flare - because both are just ILoggerProviders
registered on the same ILoggingBuilder, receiving the same ILogger
calls. Nothing about the call site changes:
logger.ZLogInformation($"hello from {"my-service"}");
Serilog (official OTLP sink — Serilog.Sinks.OpenTelemetry)
dotnet add package Serilog --version 4.3.0
dotnet add package Serilog.Sinks.OpenTelemetry --version 4.2.0
using Serilog;
using Serilog.Sinks.OpenTelemetry;
Log.Logger = new LoggerConfiguration()
.WriteTo.OpenTelemetry(options =>
{
options.Endpoint = "http://localhost:4317";
options.Protocol = OtlpProtocol.Grpc;
options.ResourceAttributes = new Dictionary<string, object>
{
["service.name"] = "my-service"
};
})
.CreateLogger();
Log.Information("hello from {ServiceName}", "my-service");
No OpenTelemetry SDK package needed — the sink builds and sends OTLP
itself. If you're already on UseSerilog()/Serilog.Extensions.Hosting
for ASP.NET Core or a generic host, WriteTo.OpenTelemetry(...) drops
into that LoggerConfiguration the same way.
NLog (OTLP target — NLog.Targets.OpenTelemetryProtocol)
dotnet add package NLog --version 6.0.4
dotnet add package NLog.Targets.OpenTelemetryProtocol --version 1.2.7
nlog.config (make sure it's copied to the output directory):
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.Targets.OpenTelemetryProtocol"/>
</extensions>
<targets>
<target xsi:type="OtlpTarget"
name="otlp"
endpoint="http://localhost:4317"
servicename="my-service"
includeFormattedMessage="true" />
</targets>
<rules>
<logger name="*" writeTo="otlp" />
</rules>
</nlog>
includeFormattedMessage="true"is worth calling out: it defaults tofalse, in which case the dashboard'sBodyshows the raw message template ("hello from {ServiceName}") instead of the interpolated string. Set it unless you specifically want template-shaped bodies.
using NLog;
var logger = LogManager.GetCurrentClassLogger();
logger.Info("hello from {ServiceName}", "my-service");
Confirm it worked
Open http://localhost:7777 and log in — your log
should already be there (live tail is on by default). Or query ClickHouse
directly (this bypasses Flare.Api/auth entirely):
curl -s "http://localhost:8123/?database=clickhousedb&user=default&password=flare" \
--data-binary "SELECT ServiceName, Body FROM logs ORDER BY Timestamp DESC LIMIT 5"
(flare is the compose-default ClickHouse password — see
.env.example if you changed it.)
ClickHouse's port is published on 127.0.0.1 only, so this works from the machine running the stack but not from
another host. The quick-install script also replaces flare with a random password in ~/.flare/.env on a first install.
To publish the port on the network, set CLICKHOUSE_BIND_ADDRESS=0.0.0.0 in .env, and change the password first.
Turn off the update check (air-gapped installs)
When a newer Flare release is out, the dashboard shows a notice under the nav
bar with its release notes, and the user menu (⋯) shows the running
version. To get this, Flare.Api asks GitHub's API for the latest release at
most once a day, and only while someone is using the dashboard. To turn that
off — for example on a host without internet access — set this on the api
service:
environment:
UpdateCheck__Enabled: "false"
A locally built image (docker compose up --build) reports version dev and
never checks.
Enable the Resources page (optional Docker access)
The dashboard's Resources page shows Flare's own containers
(ClickHouse, Redis, ingest, api, alert-worker, dashboard) as a live graph — state,
health, URLs, and the relationships between them — sourced from the Docker
Engine API. This is off by default and requires two explicit opt-ins,
because it means flare-api gaining a form of Docker access — see
ADR-0005
for why this is designed the way it is (a scoped, read-only proxy, never a
direct socket mount).
- A
.envline enabling the feature at the app level:FLARE_DOCKER_PROXY_URL=http://docker-proxy:2375 - A
.envline (orCOMPOSE_PROFILES=resource-graphon the command line) telling Compose to actually start the proxy container the above URL points at — Compose readsCOMPOSE_PROFILESfrom.envautomatically, no--profileflag needed:COMPOSE_PROFILES=resource-graph
With neither set, docker compose up behaves exactly as before — no extra
container, flare-api never talks to Docker at all, and the Resources
page shows a plain "not enabled" state rather than an error.
If you're running Flare from a consumer Aspire AppHost instead, the
Resources page is only available through the deprecated
Flare.Hosting.Aspire package's enableResourceGraph parameter; see
../../reference/aspire-hosting.md.
Using HTTP instead of gRPC
Every snippet above defaults to gRPC (:4317), matching each library's
own default. To use HTTP/protobuf on :4318 instead: MEL/ZLogger via
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf alongside the :4318
endpoint; Serilog via options.Protocol = OtlpProtocol.HttpProtobuf; NLog
via usehttp="true" on the target. There's no JSON option in any of these
SDKs' exporters — see
../../src/Flare.Ingest/README.md if
you want to send raw JSON (curl) instead of using one of these libraries
at all.
Last updated: