victorialogs-datasource icon indicating copy to clipboard operation
victorialogs-datasource copied to clipboard

support for multi-select operator in AD hoc Filters for VictoriaLogs Grafana datasource

Open enotspe opened this issue 7 months ago • 6 comments

Is your feature request related to a problem? Please describe

Curently, multi-select operators, One of (=|) or Not one of (!=|), are not supported when adding "Ad hoc filter" for victorialogs datasource.

https://grafana.com/docs/grafana/latest/dashboards/use-dashboards/#filter-dashboard-data

Only

Image

Describe the solution you'd like

being more user friendly for using Ad hoc Filters

Describe alternatives you've considered

using regexp expression

source.ip =~ 192.168.6.124|192.168.5.64

Image

Additional information

No response

enotspe avatar Apr 24 '25 00:04 enotspe

It would be great adding in, not in, contains_any and not contains_any options to the ad-hoc filter, with the ability to select multiple values out of the suggested values.

Side note: I think it would be great adding plaintext ad-hoc filter option, which allows writing arbitrary LogsQL filters as a plaintext inside the input field. The entered plaintext ad-hoc filter must be passed to VictoriaLogs as extra_filters query arg. It would be great passing other variable-based filters via extra_filters query arg too, in order to reduce the probability of incorrect modification of the original LogsQL query at plugin side.

P.S. it is better to move this feature request to the repository for VictoriaLogs plugin for Grafana - https://github.com/VictoriaMetrics/victorialogs-datasource/issues

Cc @Loori-R , @dmitryk-dk , @hagen1778 .

valyala avatar Apr 24 '25 11:04 valyala

It would be great adding in, not in, contains_any and not contains_any options to the ad-hoc filter, with the ability to select multiple values out of the suggested values.

Currently, Grafana does not support adding or modifying operators for ad-hoc filters at the plugin level. This limitation is set by Grafana itself and can only be changed via core modifications.

Loori-R avatar Apr 24 '25 11:04 Loori-R

Currently, Grafana does not support adding or modifying operators for ad-hoc filters at the plugin level. This limitation is set by Grafana itself and can only be changed via core modifications.

Could you file the corresponding feature request at Grafana repository, so Grafana developers become aware of the feature? This may help other Grafana plugins too.

What about implementing plaintext ad-hoc filter as described above?

Also, please make sure that all the selected filters are passed via extra_filters query arg as described above, in order to eliminate the possibility of improper query update with the selected filters at the plugin side. This concerns both Grafana plugin for VictoriaLogs and Web UI for VictoriaLogs.

valyala avatar Apr 24 '25 13:04 valyala

FYI, the commit f9e312f35ad337d2bf69a0ec14bb1ae952d344f7 adds support for multiple extra_filters and extra_stream_filters query args according to these docs. This should simplify using these args in VictoriaLogs plugin for Grafana and in VictoriaLogs web UI. This commit will be included in the next release of VictoriaLogs.

valyala avatar Apr 24 '25 16:04 valyala

VictoriaLogs accepts multiple extra_filters query args across all the supported querying APIs starting from v1.21.0-victorialogs according to these docs.

valyala avatar Apr 25 '25 20:04 valyala

VictoriaLogs accepts multiple extra_filters query args across all the supported querying APIs starting from v1.21.0-victorialogs according to these docs.

How do we use this feature in grafana datasource?

enotspe avatar Apr 28 '25 18:04 enotspe

The feature has been included in the v0.20.0 release of victorialogs-datasource. Closing the issue as resolved.

arturminchukov avatar Sep 11 '25 13:09 arturminchukov

I am running v.020 but still do not see one of (=|) or Not one of (!=|)

Am I missing something? How can I enable it?

enotspe avatar Sep 24 '25 15:09 enotspe

I am running v.020 but still do not see one of (=|) or Not one of (!=|)

Am I missing something? How can I enable it?

Hey @enotspe . Which version of grafana do you use? The feature available only from 11.3.x as you can see in the changelog

arturminchukov avatar Sep 24 '25 19:09 arturminchukov

Grafana cloud.

I should be on the latest version of grafana

enotspe avatar Sep 24 '25 23:09 enotspe

Grafana cloud.

I should be on the latest version of grafana

Checked it now on grafana cloud, for me it works as expected. Did you try to use it via adhoc filters?

Image

arturminchukov avatar Sep 25 '25 06:09 arturminchukov

I dont see it on my instance

Image

maybe I am missing something on my side. How is your data? how is the config of your plugin?

enotspe avatar Sep 25 '25 22:09 enotspe

@enotspe just set the db url. That's it.

arturminchukov avatar Sep 26 '25 08:09 arturminchukov

@enotspe Could be this issue related to your problem?

arturminchukov avatar Sep 26 '25 08:09 arturminchukov

you are right.

Once I refer to an specific datasource, then I do see them

Image

enotspe avatar Sep 26 '25 13:09 enotspe