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?
Hi!
You can try the following workaround:
(sorry for image, but I have some problems with correct insertion a block of XML here)
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.
Hi!
You can try the following workaround:
(sorry for image, but I have some problems with correct insertion a block of XML here)
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.
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>
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
option name="rangeValues">$tkn$
Pay attention that if you edit single value via UI, changes in options made in XML source will be overwritten.
Sorry, still problems with XML insertion here 😞
<done> <set token="tkn">$result.rangeval$</set></done>
Николай, добрый день!
Можно немного пояснить куда какой блок следует включить?
| eval rangeval="[25,50,125,200]" - в сам запрос? в query?
$result.rangeval$ - данную команду нужно вставить после query?
$result.rangeval$ - в каком месте стоит указать это определение?
Добрый день 🙂
Да, 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 иногда глючит. Но я попробовал реализовать все вышеописанное - кажется, заработало.
все получилось! Большое спасибо!!! 🙂
Отлично 🙂
Thank you!!!
It is work 🙂