Serilog.Sinks.OpenObserve-YC 1.1.1

dotnet add package Serilog.Sinks.OpenObserve-YC --version 1.1.1
                    
NuGet\Install-Package Serilog.Sinks.OpenObserve-YC -Version 1.1.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="Serilog.Sinks.OpenObserve-YC" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Serilog.Sinks.OpenObserve-YC" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Serilog.Sinks.OpenObserve-YC" />
                    
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 Serilog.Sinks.OpenObserve-YC --version 1.1.1
                    
#r "nuget: Serilog.Sinks.OpenObserve-YC, 1.1.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 Serilog.Sinks.OpenObserve-YC@1.1.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=Serilog.Sinks.OpenObserve-YC&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.OpenObserve-YC&version=1.1.1
                    
Install as a Cake Tool

Serilog Sink for OpenObserve Build status Nuget

Fork notice: This package (Serilog.Sinks.OpenObserve-YC) is a fork of Serilog.Sinks.OpenObserve-KKP by Konrad Kamiński - Pawlak, with additional features. The original package remains the upstream reference implementation.

New in this fork (v1.1.1): fix HttpClient BaseAddress Setting — useful for use sub path.

This Serilog sink allows to log to OpenObserve as the observability backend from your .NET application.

The sink is built to make use of the REST endpoint of the OpenObserve server.

Quick start

Precondition: Serilog has to be referenced in your project.

Install sink in your project.

dotnet add package Serilog.Sinks.OpenObserve-KKP

Using code configuration

Register the sink in code (Program.cs or similar).

var logger = new LoggerConfiguration()
    .WriteTo
    .OpenObserve(
        "url",
        "organization",
        "login",
        "key"
    ).CreateLogger();

Use serilog log method to log details (please check sample project).

logger.Debug("Debug message");

See Configuration specification for information about all possible parameters.

Using appsettings.json configuration

First install Serilog.Settings.Configuration package if you don't already have it:

dotnet add package Serilog.Settings.Configuration

Register the sink in code (Program.cs or similar).

var logger = new LoggerConfiguration()
    .ReadFrom.Configuration(builder.Configuration)
	.CreateLogger();

In your appsettings.json file, extend the Serilog node or fully add the following:

{
  "Serilog": {
    "Using": ["Serilog.Sinks.OpenObserve-KKP"], // Enable OpenObserve-KKP sink
    "MinimumLevel": "Debug", // General minimum level of Serilog
    "WriteTo": [
      {
        "Name": "OpenObserve", // Name of this sink, don't change
        "Args": {
          "url": "https://api.openobserve.ai",
          "organization": "[organization]",
          "login": "[username]",
          "key": "[password or token]",
          "streamName": "[custom stream name if desired]", // Optional
          "restrictedToMinimumLevel": "Information" // Optional
        }
      }
    ],
    "Properties": {
      "Application": "OpenObserve.Tests"
    }
  }
}

Use serilog log method to log details (please check sample project).

logger.Debug("Debug message");

See Configuration specification for information about all possible parameters.

Data generated

With provided configuration following data will be send to the observability backend:

{"@t":"2023-08-03T20:53:20.2872427Z","@m":"Debug message","@mt":"Debug message","@i":"9515f1e2","@l":"Debug","SourceContext":"OpenObsere.Sample.CustomBackgroundService","Application":"OpenObserve.Tests"}

On server side it should look like this:

{
  "_i": "9515f1e2",
  "_l": "Debug",
  "_m": "Debug message",
  "_mt": "Debug message",
  "_t": "2023-08-03T20:53:20.2872427Z",
  "_timestamp": 1691096013274896,
  "application": "OpenObserve.Tests",
  "sourcecontext": "OpenObsere.Sample.CustomBackgroundService"
}

Please note:

  • field _timestamp is added on server side
  • field _mt contains message template, e.g Counter: {CounterValue}
  • field _m contains rendered message, e.g. Counter: 2
  • field _i is calculated on message template text, it's different for each different message template

More information about using Serilog is available in the Serilog Documentation.

Configuration specification

Parameters

Parameter Description Example
Url OpenObserve api endpoint https://api.openobserve.ai (SaaS) <br/>https://myserver.com/api (self-hosted)
Organization Identifier of your organization within OpenObserve. Can be seen in the web interface on the top right. <br/><br/>OpenObserve SaaS: please ensure to use your organization identifier. <br/><br/>Self-hosted: you may use any value you prefer. Defaults to "default". <br/>The organization will be created automatically. SoftwareBros
Login Username aka mail address of the OpenObserve user name@myserver.com
Key Password or Token for authentication for the provided user SecureToken
StreamName ObenObserve stream identifier default
RestrictedToMinimumLevel Overwrite minimum log severity to be handled for this sink Information<br/>Default: the same as Serilog global </br>Options: Serilog.Events.LogEventLevel

Please note: It is NOT recommended to store your user password in a configuration of your application. Those credentials allow to login into the OpenObserve web interface. It is highly recommended to only use the token as key.

What is a token?

A token is a generated text string, having the function of a password, usually used for authentication. It allows to authenticate against the api without providing your actual user password.

How to retrieve my credentials / token

The OpenObserve web interface provides configuration examples under "Data sources".

"Data sources" - "Custom" - "Logs" - "Curl" shows the current username and token (format: username:token).
"Data sources" - "Custom" - "Logs" - "Syslog-Ng" shows a configuration similiar (not identical!) to one required for this sink.

Note: Currently OpenObserve only allows one token per user. It can be resetted in the "Data sources" page however no additional tokens can be generated. The token cannot be limited to any stream or organization.

What is an organization?

An organization is a management unit of users. For the self hosted system you may create any amount of organizations. The active organization can be seen in the web interface top right corner.

What is a stream?

A stream is a storage endpoint within OpenObserve. Streams can be created in the web interface but will also be automatically created as soon as log data specifying a stream is inbound. A stream contains specific storage configuration such as data retention.

REST

The sink is creating a REST POST command to the provided endpoint. Specifically the data will be sent to endpoint POST /api/{organization}/{stream}/_multi.

Please refer to the OpenObserve API documentation for more information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1 124 7/30/2026