How do you derive metrics from logs, and when should you?

IntermediateProductionLog Pipelines
Answer

When you cannot change the app (legacy, third party) or need a quick metric from existing logs. Loki recording rules:

- record: nginx:requests_5xx:rate5m
  expr: sum by (cluster, app) (rate({app="nginx"} | json | status >= 500 [5m]))

Or count in the pipeline (Vector log_to_metric, OTel count connector) before storage. Native app metrics are still preferred: cheaper, more reliable.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Log Pipelines