Seq.App.Prometheus 1.0.1

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

Seq.App.Prometheus

A Seq app that exposes Prometheus metrics based on a YAML configuration file, allowing you to monitor your Seq event log through Prometheus.

Overview

Seq.App.Prometheus is a plugin for Seq that enables you to expose custom metrics from your Seq event log in Prometheus format. This allows you to integrate your Seq logs with Prometheus monitoring and create dashboards using tools like Grafana.

Features

  • Expose custom metrics from Seq logs in Prometheus format
  • Configure metrics through YAML configuration
  • Support for counter metrics
  • Optional Bearer token authentication
  • Customizable HTTP endpoint and port
  • Built on .NET 8.0

Installation

  1. Download the latest release from the releases page
  2. Install the app in your Seq instance through the Seq UI:
    • Go to Settings > Apps
    • Click "Add App"
    • Upload the downloaded package

Configuration

The app requires the following settings:

Required Settings

  • YAML configuration: A YAML file that defines your metrics
  • HTTP Listener port: The port number where the metrics endpoint will be exposed

Optional Settings

  • Bearer token: Authentication token for securing the metrics endpoint
  • URL for metrics: Custom URL path for the metrics endpoint (defaults to /metrics)

YAML Configuration Format

The YAML configuration file defines the metrics you want to expose. Each metric is defined as an object in the configuration array.

Schema
- name: string              # Required: Name of the metric
  description: string       # Optional: Description of what the metric measures
  type: string              # Required: Type of metric (currently only 'counter' is supported)
  filter: string            # Required: Seq expression language filter condition
  labels:                   # Optional: Array of label configurations
    - name: string          # Required: Name of the label
      value: string         # Required: Value template using Seq property syntax
Examples

Basic counter metric:

- name: log_events_total
  description: Total number of log events
  type: counter
  labels:
    - name: level
      value: "{@Level}"
  filter: "@Level = 'Error'"

Multiple labels with filter:

- name: api_requests_total
  description: Total number of API requests
  type: counter
  labels:
    - name: method
      value: "{@Properties['HttpMethod']}"
    - name: endpoint
      value: "{@Properties['Path']}"
    - name: status
      value: "{@Properties['StatusCode']}"
  filter: "@Properties['HttpMethod'] = 'POST' and @Properties['StatusCode'] >= 400"

Using custom properties with complex filter:

- name: business_events_total
  description: Total number of business events
  type: counter
  labels:
    - name: event_type
      value: "{@Properties['EventType']}"
    - name: tenant
      value: "{@Properties['TenantId']}"
    - name: environment
      value: "{@Properties['Environment']}"
  filter: "@Properties['EventType'] in ('OrderCreated', 'OrderCompleted') and @Properties['Environment'] = 'Production'"
Label Value Templates

Label values can use Seq's property syntax to extract values from log events:

  • {@Level} - Log level
  • {@Properties['PropertyName']} - Custom property value
  • {@Message} - Log message
  • {@Timestamp} - Event timestamp
  • {@Exception} - Exception details (if present)
Filter Expressions

The filter field uses Seq's expression language to determine which events should be counted. Examples of valid filter expressions:

  • @Level = 'Error' - Count only error level events
  • @Properties['HttpMethod'] = 'POST' - Count only POST requests
  • @Properties['StatusCode'] >= 400 - Count only error responses
  • @Properties['EventType'] in ('OrderCreated', 'OrderCompleted') - Count specific event types
  • @Properties['Environment'] = 'Production' - Count only production events
  • @Level = 'Error' and @Properties['Source'] = 'ApiController' - Count errors from specific source
  • @Properties['Duration'] > 1000 - Count slow operations

Usage

  1. Configure the app in Seq with your desired settings
  2. Access the metrics endpoint at http://your-seq-server:port/metrics (or your custom URL)
  3. Configure Prometheus to scrape the metrics endpoint
  4. Use the metrics in your Prometheus dashboards

Authentication

If you've configured a Bearer token:

  1. Include the token in your requests using the Authorization header
  2. Format: Authorization: Bearer your-token-here

Development

Prerequisites

  • .NET 8.0 SDK or later

Building

dotnet build

Testing

dotnet test

Dependencies

  • prometheus-net (8.2.1)
  • Seq.Apps (2023.4.0)
  • Seq.Syntax (1.0.0)
  • YamlDotNet (16.3.0)
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 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. 
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.0.1 223 6/26/2025
1.0.0 184 6/26/2025