Skip to main content
Metric configurations define how LogFleet extracts metrics from logs at the edge. Instead of shipping raw logs to the cloud (expensive and bandwidth-intensive), you configure extraction rules that run on edge agents.

How It Works

Logs → Pattern Matching → Metric Extraction → Cloud
      (at edge)          (at edge)          (metrics only)
This reduces bandwidth by 100-1000x compared to shipping raw logs.

Metric Types

TypeDescriptionExample Use Case
CounterCounts occurrencesHTTP requests, errors, events
GaugePoint-in-time valueTemperature, queue size, connections
HistogramValue distributionsResponse times, payload sizes

Configuration Structure

{
  "name": "nginx_metrics",
  "description": "Extract metrics from nginx access logs",
  "log_source": "nginx",
  "metrics": [
    {
      "name": "http_requests_total",
      "type": "counter",
      "pattern": "\\\"(GET|POST|PUT|DELETE)\\s",
      "labels": ["method", "status"]
    },
    {
      "name": "response_time_seconds",
      "type": "histogram",
      "pattern": "request_time=([0-9.]+)",
      "buckets": [0.01, 0.05, 0.1, 0.5, 1.0, 5.0]
    }
  ]
}

Version Control

Metric configs use optimistic locking to prevent conflicts:
  1. Each config has a version field
  2. When updating, include the current version
  3. If version doesn’t match, update fails with 409 Conflict
  4. Re-fetch, resolve conflicts, and retry
This ensures safe concurrent edits across your team.

Deployment to Agents

When you create or update a metric config:
  1. Config is stored in LogFleet platform
  2. Agents sync configs periodically via /edge/sync-config
  3. Agents apply new extraction rules immediately
  4. New metrics start flowing to cloud
Config changes typically propagate to all agents within 60 seconds.