cloudflare-log-collector

config

import "github.com/afreidah/cloudflare-log-collector/internal/config"

Index

func ParseLogLevel

func ParseLogLevel(s string) slog.Level

ParseLogLevel maps a config string to an slog.Level.

type CloudflareConfig

CloudflareConfig holds Cloudflare API connection settings.

type CloudflareConfig struct {
    APIToken       string        `yaml:"api_token"`
    Zones          []ZoneConfig  `yaml:"zones"`
    PollInterval   time.Duration `yaml:"poll_interval"`
    BackfillWindow time.Duration `yaml:"backfill_window"`
}

type Config

Config holds the complete service configuration.

type Config struct {
    Cloudflare CloudflareConfig `yaml:"cloudflare"`
    Loki       LokiConfig       `yaml:"loki"`
    Metrics    MetricsConfig    `yaml:"metrics"`
    Tracing    TracingConfig    `yaml:"tracing"`
    Logging    LoggingConfig    `yaml:"logging"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads the YAML file at path, expands environment variables, and returns a validated Config.

type LoggingConfig

LoggingConfig holds structured logging settings.

type LoggingConfig struct {
    Level  string `yaml:"level"`
    Format string `yaml:"format"`
}

type LokiConfig

LokiConfig holds Loki push API settings.

type LokiConfig struct {
    Endpoint  string `yaml:"endpoint"`
    TenantID  string `yaml:"tenant_id"`
    BatchSize int    `yaml:"batch_size"`
}

type MetricsConfig

MetricsConfig holds Prometheus metrics endpoint settings.

type MetricsConfig struct {
    Listen string `yaml:"listen"`
}

type TracingConfig

TracingConfig holds OpenTelemetry tracing settings.

type TracingConfig struct {
    Enabled    bool    `yaml:"enabled"`
    Endpoint   string  `yaml:"endpoint"`
    SampleRate float64 `yaml:"sample_rate"`
    Insecure   bool    `yaml:"insecure"`
}

type ZoneConfig

ZoneConfig identifies a single Cloudflare zone to monitor.

type ZoneConfig struct {
    ID   string `yaml:"id"`
    Name string `yaml:"name"`
}

Generated by gomarkdoc