LOKI - sum of metric values in log lines

I have following log :
at=2024-03-25T21:40:48Z name=“Jeffry Deckow” has_account=false total_amount=33.27 event=“New customer order.”
at=2024-03-25T21:40:49Z name=“Laron Brakus” has_account=false total_amount=134.43 event=“New customer order.”

Is it possible to write query to sum total_amount, for example for 21 (9PM) I would like to sum(33.27, 134,43) to have value 167,7. I know that I can count number of line, rate etc. But the case is it possible directly to sum metrics which are in log?

Yes, you can use unwrap for this. See Metric queries | Grafana Loki documentation.

In your example, it would be something like this (not tested):

    | logfmt
    | unwrap total_amount