I’m using the Grafana 7.5.4 along with Loki 2.1.0. With new Loki queries, I have successfully parsed fields from my logs.
{filename=~"home/data/logs/backup_dag/push_targets/.*/*.log"}
|= "abs.network"
| logfmt
Now I’m trying to apply the following Transforms in the Dashboard pannel with Table visualization selected:
Labels to fileds
→ Filter by name
(selected upload
field) → Reduce
(selected Mean)
For some reason Mean
, Min
, Max
etc don’t work, but First
, First(non null)
, Last
, Last(non null)
do work.
I kinda have no idea why this is happening though, if I remove the Reduce
Transform I seem to have a valid table on which all functions could be applied
Any ideas?
Can’t add more the two images as a new user:
Table dashboard pannel after I remove Reduce
:
Hey @rafayak
I think this is more of a question for #support ; this question does not appear to be Loki-specific.
I’m curious though why you don’t perform these transformations with LogQL - is there some limiting factor here?
@dannykopping I got the idea of this from the Loki issues on github. The issue describes a problem similar to mine.
opened 04:50PM - 28 Jan 21 UTC
Hi, @owen-d, @cyriltovena,
I'm trying to do something that is new to me with … a loki query to make up a dashboard. I am interested in monitoring a variable in a log that takes different values over time.
I use logfmt to extract the variable from the log to a parsed field "Duration", which appears as, for instance "1s". I'm now trying to pipe this to unwrap so that I can plot it in a graph using the following query:
{stack="stack1", selection"selection_name"} |= "Completed" | logfmt | unwrap duration_seconds(Duration)
which I got the inspiration for from here: https://grafana.com/docs/loki/latest/logql/#unwrapped-range-aggregations
This doesn't work, and I get the error:
parse error at line 1, col 93: syntax error: unexpected unwrap
Object
status:400
statusText:""
data:Object
error:""
response:"parse error at line 1, col 93: syntax error: unexpected unwrap"
message:"parse error at line 1, col 93: syntax error: unexpected unwrap"
config:Object
url:"api/datasources/proxy/9/loki/api/v1/query_range?direction=BACKWARD&limit=1000&query=%7Bstack%3D%22stack1%22%2C%20selection%3D%22selection_name%22%7D%20%7C%3D%20%22Completed%22%20%7C%20logfmt%20%7C%20unwrap%20duration_seconds(Duration)&start=1611848857000000000&end=1611852458000000000&step=2"
retry:0
headers:Object
hideFromInspector:false
message:"parse error at line 1, col 93: syntax error: unexpected unwrap"
I've tried for a fair while to get this to work, with different permutations, switching form logfmt to using regexp etc... but to no avail.
Any chance you could drop me a hint as to what I am doing wrong?
I'm sure its something simple, I just can't see it.
Thanks,
Aaron
Also, what I’m trying to do s create a metric (a single number) to show in my dashboard
system
Closed
June 29, 2022, 8:27am
6
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.