# Tags Query : Grafana / influxdb formatting

**URL:** <https://community.influxdata.com/t/tags-query-grafana-influxdb-formatting/7944>\
**Category:** Dashboards\
**Tags:** grafana\
**Created:** [December 24, 2018, 12:43pm UTC](https://community.influxdata.com/t/tags-query-grafana-influxdb-formatting/7944 "2018-12-24T12:43:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerome\_Strabach](https://avatars.discourse-cdn.com/v4/letter/j/35a633/32.png) [@Jerome\_Strabach](https://community.influxdata.com/u/Jerome_Strabach)\
**Post date:** [December 24, 2018, 12:43pm UTC](https://community.influxdata.com/t/tags-query-grafana-influxdb-formatting/7944/1 "2018-12-24T12:43:40Z")

</div>

I have in my database a list of hosts  
I set a variable $NodeId that allows me to select one or more hosts  
A priori, it is possible to group multiple hosts with a tag  
But I can not find the syntax for multiple tags  
With the function : variable/tags query

Ex:  
Site1: equip101, equip102, equip103  
Site 2: equip201, equip202, equip203

I want 2 tags : Site1 et Site 2  
For example,  
When I click on Site1 the hosts equip101 and equip102 are selected  
When I click on Site2 the hosts equip201 and equip202 are selected

thanks in advance

---

<div class="post-metadata">

**Author:** ![Esity](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/esity/32/5864_2.png) [@Esity](https://community.influxdata.com/u/Esity)\
**Post date:** [December 24, 2018, 4:04pm UTC](https://community.influxdata.com/t/tags-query-grafana-influxdb-formatting/7944/2 "2018-12-24T16:04:00Z")

</div>

What you need to do is tag it that way coming into InfluxDB.

You should include the tag site = 1, equipment = equip101 or something like that. That will allow scaling. I don’t know if you can do good searching by a tag key. Settings it to a value will allow you to do easy filtering

---

<div class="post-metadata">

**Author:** ![svet](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/svet/32/7092_2.png) [@svet](https://community.influxdata.com/u/svet)\
**Post date:** [December 25, 2018, 1:20pm UTC](https://community.influxdata.com/t/tags-query-grafana-influxdb-formatting/7944/3 "2018-12-25T13:20:07Z")

</div>

@Esity is right that the only real way to make this work nicely (/in a scalable way) is to apply the site as a separate tag.

If you _really_ need to do filtering on your existing data in Grafana, the way you describe, you can create a template variable (`$filterVar`) with a dropdown with some hardcoded values like `(equip101|equip102|equip103)` or `equip10.*`, `equip20.*`, etc, and use that variable in a query filter on your existing tag, e.g `WHERE NodeID =~ /^[[filterVar]]$/`. But that’s obviously pretty ugly.
