1

In Grafana I've got a table panel which contains some names (one each row), that, if clicked, open a new window on Kibana passing via URL the name the user clicked (${__cell}) in order to Drill-Down that particular name.

This use to works fine, but I'm facing a problem when then name contains a special character such as "Identita' Digitale" (without double quote): as you can see it contains an apostrophe/single quote that breaks the query so the Kibana's URL becomes uncomplete.

gigapico00
  • 417
  • 1
  • 7
  • 24

1 Answers1

0

Try

${__cell:lucene}

instead of

${__cell}

All special characters should be escaped for Lucene query. Actually, you need URL encode for your case - you may try other advanced formatting options.

Doc: http://docs.grafana.org/reference/templating/#advanced-formatting-options

Another dirty hackish solution, use JS to urlencode link in the onclick event, add this string at the end of your link definiton in the Grafana:

" onclick="location.href=encodeURI(this);

So in full HTML it will create link:

<a href="<URL>" onclick="location.href=encodeURI(this);">...

Syntax in my example can be wrong, it may need some minor changes to work properly. You can use jQuery in theory.

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
  • I tried, once clicked, Kibana says "Unable to parse URL" if the name contains a single quote, while if it doesn't, Kibana just doesn't show anything since ${__cell} becomes (let's say) "LISTA\ DIARIA". – gigapico00 Oct 02 '18 at 10:31
  • So you need proper URL encoding of cell values in Grafana - ' = %27 in URL for Kibana (which is not available as you see). Or use it as a variable in another Grafana dashboard and make Lucene query there. – Jan Garaj Oct 02 '18 at 10:37
  • I didn't get what you mean with "which is not availabe as you see". The URL depending on the case could contains or couldn't contains ' (single quote) in it, so I just can't arbritrary type %27 in the URL. Unfortunately I need to make Lucene Query in Kibana. – gigapico00 Oct 02 '18 at 12:47
  • => As I know string functionality urlencode is not available in the Grafana = Grafana is not able to convert ' into %27 (generally any special char) for you. – Jan Garaj Oct 02 '18 at 12:52
  • Alright thank you. I believe that too. In case I find something useful I'll update this question. – gigapico00 Oct 02 '18 at 14:36
  • Solved creating a Google Chrome Extension that does a redirect in case it finds "Identita%26%2339;%20Digitale" (which is the value of failing ${__cell}) in the URL. In Kibana I've created a filter with Identita' Digitale just to see how the URL would change, then I've used that URL in my extension. – gigapico00 Oct 06 '18 at 13:56