I am new to Grafana and Loki and have a scenario where I need to do a calculation based on conditional scenarios in Loki QL. the scenario goes like this:
if (take each digit in number and multiply by 2 and if it is greater than 10 then use first digit else keep it as is as it would be a single digit ) eq 0 then show the details in the Grafana dashboard.
I am not able to put up the if condition inside the if condition (nested-if). I was looking something like this but it isnt working :
| line_format `{{if eq {{if eq (div (mul (.somelabel | substr 0 1) 2) 10) 1}}{{(mul (.somelabel | substr 0 1) 2)}}{{else}}(.somelabel | substr 0 1){{end}}) 0}}{{.somelabel}}{{end}}
cant think of any alternate way! Thanks !!!
Arjit Goswami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.