githubEdit

Configuration Overview

Mermin uses HCL (HashiCorp Configuration Language) as its primary configuration format, providing a human-readable and flexible way to configure all aspects of the observability agent.

Configuration File Format

Mermin supports two configuration formats:

HCL is the recommended format, offering:

  • Clear, readable syntax

  • Built-in support for expressions and functions

  • Native block and attribute structure

  • Better error messages

Example HCL configuration:

log_level = "info"

discovery "instrument" {
  interfaces = ["eth*", "ens*"]
}

export "traces" {
  otlp = {
    endpoint = "http://otel-collector:4317"
    protocol = "grpc"
  }
}

YAML (Supported)

YAML is also supported through conversion. To use YAML:

However, HCL is recommended for direct use with Mermin.

Configuration Precedence

Mermin loads configuration in the following order (later sources override earlier):

  1. Built-in Defaults: Sensible defaults for all options

  2. Configuration File: HCL or YAML file specified via --config

  3. Environment Variables: Only for global options (see below)

  4. Command-Line Arguments: Only for global options (see below)

circle-info

Only global options can be set via environment variables and CLI flags. All other configuration must be in the configuration file.

Example Precedence

Result: log_level will be debug.

Configuration File Location

Specify the configuration file using:

Command-Line Flag

Environment Variable

Kubernetes ConfigMap

Then mount in pod and reference:

Auto-Reload Feature

Mermin can automatically reload configuration when the file changes:

Or via environment/CLI:

When enabled:

  • Mermin watches the config file for changes

  • Automatically reloads and applies new configuration

  • No restart required

  • Minimal disruption (brief pause in flow capture during reload)

circle-exclamation

Configuration Structure

Mermin configuration is organized into logical sections:

Global Options

Top-level settings that affect overall behavior:

See Global Options for details.

API and Metrics

Health check and metrics endpoints:

circle-exclamation

See API and Metricsarrow-up-right and Debug Metricsarrow-up-right for details.

Parser Configuration

eBPF packet parsing options:

See Parser Configuration for details.

Discovery

Network interface and Kubernetes resource discovery:

See Network Interface Discoveryarrow-up-right and Kubernetes Informersarrow-up-right.

Kubernetes Relations

Configure how flows are enriched with Kubernetes metadata:

See Owner Relations and Selector Relations.

Flow Attributes

Define which Kubernetes metadata to extract and associate with flows:

See Flow Attributes for details.

Filtering

Filter flows before export:

See Flow Filtering for details.

Span Options

Configure flow span generation and timeouts:

See Flow Span Optionsarrow-up-right for details.

Export Configuration

Configure OTLP and stdout exporters:

See OTLP Exporter and Stdout Exporter.

Internal Tracing

Configure Mermin's own telemetry:

See Internal Tracing for details.

Validation

Mermin validates configuration on startup and reports errors:

To test configuration without running:

Configuration Examples

See Configuration Examples for complete, real-world configurations:

  • Production-ready configuration

  • Development/testing configuration

  • CNI-specific configurations

  • High-throughput configuration

  • Security-hardened configuration

Configuration Reference

Detailed documentation for each configuration section:

Section
Description

Top-level settings and CLI flags

Health checks and Prometheus metrics

eBPF packet parsing options

Interface discovery patterns

Owner reference walking

Label selector matching

Metadata extraction and association

Flow filtering rules

Flow generation and timeouts

OpenTelemetry Protocol export

Console output for debugging

Mermin self-monitoring

Best Practices

  1. Start with minimal configuration: Add complexity as needed

  2. Use comments: Document why specific settings are chosen

  3. Version control: Track configuration changes in Git

  4. Test in non-production: Validate changes before production deployment

  5. Monitor metrics: Ensure configuration performs as expected

  6. Use auto-reload: For easier configuration iteration

  7. Keep secrets separate: Use environment variables or Kubernetes secrets for sensitive data

Next Steps

Last updated