How to use variable as prefix with Influxdb

templating
#1

Hi.
I use Grafana for years, but just now I started using templates. Loved it.
I’m using InfluxDB as Data Source and I have directories like this:

/path/to/directory1/processing
/path/to/directory1/processed
/path/to/directory1/errors
/path/to/directory2/processing
/path/to/directory2/processed
/path/to/directory2/errors
...

So, if I configure /path/to/** as “directories” in telegraf.conf, detects every directory, its files, etc. Great…

In Grafana I configure “show tag values from filecount with key=“directory”” and $test_directory as variable name.
Now, if I select /path/to/directory1/ I would like to have graphs of *.errors, *.processing and *.processed, with something like this:

SELECT mean("count") FROM "filecount" WHERE ("host" = 'server_name' AND "directory" =~ /^$test_directory$/).errors AND $timeFilter GROUP BY time($__interval) fill(null)
SELECT mean("count") FROM "filecount" WHERE ("host" = 'server_name' AND "directory" =~ /^$test_directory$/).processed AND $timeFilter GROUP BY time($__interval) fill(null)
SELECT mean("count") FROM "filecount" WHERE ("host" = 'server_name' AND "directory" =~ /^$test_directory$/).processing AND $timeFilter GROUP BY time($__interval) fill(null)

And doesn’t work.
I tried:
“directory” =~ ‘/^test_directory/).processing’
“directory” =~ /^test_directory/).+‘processing’
“directory” =~ (/^test_directory/.processing)
No luck…

Thanks,

Sacha.