Promtail parse duration for metrics


Is there any proper way to parse duration in milliseconds, seconds and so on?

I’ve log output as duration in different formats - like 4.60ms, 5.45s, if I use these strings as metric source Promtail does not expose it to /metrics endpoint

So what should I do?
Is it needs to parse duration strings as numeric? If so, how it could be implemented?
Or is there any way to supply duration string (as ms or s format) to metrics directly?

Thanks a lot!

Hi @andrewsorokin
Thank you for your question!

Promtail does not currently support extracting metrics from duration string formats. However, this is certainly a valuable feature and an issue to address this was created: Promtail metrics support duration string formats · Issue #5288 · grafana/loki · GitHub

Thanks :slight_smile: