Reduce number of data points using aggregate function

Hi,

I have a grafana dashboard for Log viewer using flux however we have a filter at the top where we can select a specific path which would be a specific components log or we can filter by host where we pick 1 host and get all logs for that 1 particular host. This used to work in our influxdb panel however since the migration to flux the dashboard complains with the below error message when i try to use any of the filtering on the dashboard. I will insert the flux query below. Any help would be appreciated.

import “influxdata/influxdb/schema”

from(bucket: “eBondLogs/one_day_only”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “ebond_log”)
|>schema.fieldsAsCols()

A query returned too many datapoints and the results have been truncated at 11881 points to prevent memory issues. At the current graph size, Grafana can only draw 1188. Try using the aggregateWindow() function in your query to reduce the number of points returned.

Hi guys, is anyone able to assist?

Hello @Niikhiil1997,
Sorry for the delay and thank you for bumping. Sometimes questions get lost.

So just to reiterate you’re not able to add additional filters? Like…

|> filter(fn: (r) => r.host == “1 particular host”)

I’m nost sure how to manage variables in Grafana, but I know you can in the influxDB UI to limit your query response:
https://docs.influxdata.com/influxdb/v2.0/visualize-data/variables/

Have you tried incorporating variables?