Dashboards & Visualizations

On one dashboard, how to create one multiselect to create two variables with different values of delimiter and prefix?

yav2810
Explorer

On the dashboard, I use 2 multiselect with the same values, but with different parameters delimiter and prefix. Is it possible to use one multiselect to create two variables with different values of delimiter and prefix. If so, how?

0 Karma
1 Solution

nryabykh
Path Finder

Hi!
You can try the following workaround:
(sorry for image, but I have some problems with correct insertion a block of XML here)

alt text

The point is to eval new token in change block of multiselect input:
<eval token="token_ms2">replace(replace($token_ms$, "prf1", "prf2"), "delim1", "delim2")</eval>
where prf1 is the prefix in multiselect and delim is the delimiter.

View solution in original post

nryabykh
Path Finder

Hi!
You can try the following workaround:
(sorry for image, but I have some problems with correct insertion a block of XML here)

alt text

The point is to eval new token in change block of multiselect input:
<eval token="token_ms2">replace(replace($token_ms$, "prf1", "prf2"), "delim1", "delim2")</eval>
where prf1 is the prefix in multiselect and delim is the delimiter.

yav2810
Explorer

Prompt, and whether it is possible such method is applicable for the decision of other problems: in request the value of a variable is calculated. It is necessary, depending on its value, to expose the rangeValues in the SingleValue dashboard
option name="rangeValues">[25,50,125,200]

  <title>titleс</title>
  <single>
    <search>
      <query>query</query>
      <earliest>-30d@d</earliest>
      <latest>now</latest>
      <sampleRatio>1</sampleRatio>
      <refresh>5m</refresh>
      <refreshType>delay</refreshType>
    </search>
    <option name="colorBy">value</option>
    <option name="colorMode">block</option>
    <option name="drilldown">none</option>
    <option name="numberPrecision">0</option>
    <option name="rangeColors">["0x6db7c6","0xf7bc38","0x65a637","0xf58f39","0xd93f3c"]</option>
    <option name="rangeValues">[25,50,125,200]</option>
    <option name="refresh.display">progressbar</option>
    <option name="showSparkline">1</option>
    <option name="showTrendIndicator">1</option>
    <option name="trellis.enabled">0</option>
    <option name="trellis.scales.shared">1</option>
    <option name="trellis.size">medium</option>
    <option name="trendColorInterpretation">standard</option>
    <option name="trendDisplayMode">absolute</option>
    <option name="unit">%</option>
    <option name="unitPosition">after</option>
    <option name="useColors">1</option>
    <option name="useThousandSeparators">1</option>
  </single>
</panel>
0 Karma

nryabykh
Path Finder

If I understood correctly, this might help. Append | eval rangeval="[25,50,125,200]" at the end of your query (of course, you can define this field as you need, based on other fields in search results). Then add done section into the search block:


search
query
...
query
$result.rangeval$
search

And then modify option: option name="rangeValues">$tkn$

Pay attention that if you edit single value via UI, changes in options made in XML source will be overwritten.

0 Karma

nryabykh
Path Finder

Sorry, still problems with XML insertion here 😞
<done> <set token="tkn">$result.rangeval$</set></done>

0 Karma

yav2810
Explorer

Николай, добрый день!
Можно немного пояснить куда какой блок следует включить?
| eval rangeval="[25,50,125,200]" - в сам запрос? в query?
$result.rangeval$ - данную команду нужно вставить после query?
$result.rangeval$ - в каком месте стоит указать это определение?

0 Karma

nryabykh
Path Finder

Добрый день 🙂
Да, eval можно включить в конец самого запроса (query). Это, по идее, не должно никак сказаться на отображении самого single value, т.к. это поле допишется справа в таблицу, а single value возьмет первое значащее поле слева. Eval я написал для примера, это поле можно, разумеется, формировать как угодно в пределах SPL 🙂

Далее, в XML внутрь блока search (там, где уже есть query, earliest, latest, sampleRation, refresh) надо добавить блок done - в нем указываются инструкции, которые надо будет выполнить по завершении запроса. Вот тут есть примеры: http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/tokens#Search_event_elements_and_job_propertie...
В done надо выставить новый токен, в него прописать значение поля rangeval:
<set token="tkn">$result.rangeval$</set>

А дальше в значении опции rangeValues надо указать $tkn$. Тогда rangeValues будет формироваться динамически в зависимости от значения этого токена, который мы вставили в done.

К сожалению, я замечал, что использование токенов в options чартов/таблиц/singleValue иногда глючит. Но я попробовал реализовать все вышеописанное - кажется, заработало.

0 Karma

yav2810
Explorer

все получилось! Большое спасибо!!! 🙂

0 Karma

nryabykh
Path Finder

Отлично 🙂

0 Karma

yav2810
Explorer

Thank you!!!
It is work 🙂

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...