This just works for me, and then I can do whatever I want with the logs. e.g. calculating metrics:
pipeline_stages:
- decolorize:
- regex:
expression: 'REQUEST FINISHED:.*-\s(?P<latency>\d+)ms$'
action: keep
- metrics:
insly_request_latency_ms:
type: Histogram
description: "Histogram of request latencies (ms)"
source: latency
config:
buckets: [100, 250, 500, 1000, 5000, 10000, 30000, 60000]
https://grafana.com/docs/loki/latest/send-data/promtail/stages/decolorize/