I have stream of http logs json via Loki that look like:
2022-11-30 16:18:46 {"message":{"duration":"8.37ms","env":"dev","path":"/rest/path1","status":200}}
2022-11-30 16:18:46 {"message":{"duration":"112.32ms","env":"dev","path":"/rest/path2","status":200}}
2022-11-30 16:18:46 {"message":{"duration":"32.37ms","env":"dev","path":"/rest/path1","status":200}}
2022-11-30 16:18:46 {"message":{"duration":"21.337ms","env":"dev","path":"/rest/path3","status":200}}
I'd like to display average response time by path.
I am able convert this data in to table with grafana transformation. and then looking to for average of max duration time based on path.
have you tried looking at range queries? First you would need to extract the duration. See how I did it here using the LogQL Analyzer.
Then you can use a range query with
avg_over_time
.You would end up with a query like this:
Hope this helps :).