Is it possible to convert string values to numbers in LogQL?

Viewed 2789

I am following documentation and thanks to | line_format and regexReplaceAll I was able to fetch some substring from a line.

Let's say now I have those columns:

line
123
7
123
54
14

Having that I want to perform some transform operation, ex sum, or transform operation with grouping by and taking total. It is not working as I am suspecting those values are not being numbers, but only strings. Is it possible to convert it to numbers?

I was trying using unwrap but it didn't worked:

sum_over_time(
    {service="some"} 
    |="text expression"
    | json
    | line_format `{{ regexReplaceAll "text expression to remove from (\\d+)" .label_id "${1}" | trim }}`
    | unwrap label_id [1m]
)

it ends up with

pipeline error: 'SampleExtractionErr' for series:

when I am filtering out errors, there is no results.

0 Answers
Related