Splunk Dev

ドロップダウンから複数トークンを取得する方法

kessekiou
Engager

Subjectの通りなのですが、ドロップダウンから複数のトークンを取得する手段をご教示いただきたく。

実現したい内容としては、以下のようなテーブルにおいて、ドロップダウンでName「テスト1」を選択した際、IdValueをトークンとして利用したいというものです。

IdNameValue
A001テスト11000
A002テスト22000


それぞれ何に用いるかというと、Idは表示対象の絞り込みに、ValueはグラフのY軸の最大値に設定したく。

以下に必要になる箇所のコードをサンプル的に記載させていただきました。
Idを使っての絞り込みは実現出来ているため、

  1. Valueをトークンに設定する方法
  2. Y軸の最大値の設定方法が記載内容で実現できるか(<option name="charting.axisY.maximumNumber">$value$</option> の箇所)

をご教示いただけないでしょうか。

よろしくお願いいたします。

 

<form theme="light">
  <label>hogehoge</label>
  <fieldset submitButton="false" autoRun="false">
    <input type="dropdown" token="id">
      <label>hogehoge</label>
      <fieldForLabel>Name</fieldForLabel>
      <fieldForValue>Id</fieldForValue>
      <search>
        <query>index="list" 
                | table Id, Name, Value 
                | sort Id
        </query>
        <earliest>0</earliest>
        <latest></latest>
      </search>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>LineChart</title>
      <chart>
        <search>
          <query>

	~  省略  ~

          </query>
          <earliest>0</earliest>
          <latest></latest>
          <sampleRatio>1</sampleRatio>
        </search>

        <option name="charting.axisY.maximumNumber">$value$</option>

        ~  省略  ~

      </chart>
    </panel>
  </row>
</form>

 

 

Labels (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

 

@kessekiou 

この例がこれに役立つかもしれません。

May be this example will help you in this.

 

<form theme="light">
  <label>hogehoge</label>
  <fieldset submitButton="false" autoRun="false">
    <input type="dropdown" token="id">
      <label>hogehoge</label>
      <fieldForLabel>Name</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>index=_internal | stats count by sourcetype | eval Name= "This is ".sourcetype</query>
        <earliest>0</earliest>
        <latest></latest>
      </search>
      <change>
        <set token="tkn_sourcetype">$row.sourcetype$</set>
        <set token="tkn_value">$row.Name$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>LineChart</title>
      <chart>
        <search>
          <query>
            index=_internal sourcetype="$tkn_sourcetype$" | stats count by sourcetype          
            </query>
          <earliest>0</earliest>
          <latest></latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="charting.axisTitleX.text">$tkn_value$</option>
      </chart>
    </panel>
  </row>
</form>

 

 

If this reply helps you, an upvote would be appreciated.

Thanks
Kamlesh Vaghela

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

 

@kessekiou 

この例がこれに役立つかもしれません。

May be this example will help you in this.

 

<form theme="light">
  <label>hogehoge</label>
  <fieldset submitButton="false" autoRun="false">
    <input type="dropdown" token="id">
      <label>hogehoge</label>
      <fieldForLabel>Name</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>index=_internal | stats count by sourcetype | eval Name= "This is ".sourcetype</query>
        <earliest>0</earliest>
        <latest></latest>
      </search>
      <change>
        <set token="tkn_sourcetype">$row.sourcetype$</set>
        <set token="tkn_value">$row.Name$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>LineChart</title>
      <chart>
        <search>
          <query>
            index=_internal sourcetype="$tkn_sourcetype$" | stats count by sourcetype          
            </query>
          <earliest>0</earliest>
          <latest></latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="charting.axisTitleX.text">$tkn_value$</option>
      </chart>
    </panel>
  </row>
</form>

 

 

If this reply helps you, an upvote would be appreciated.

Thanks
Kamlesh Vaghela

0 Karma

kessekiou
Engager

@kamlesh_vaghel

Thanks!

I was able to solve the problem with the code you showed me.

・・・

      <change>
        <set token="tkn_sourcetype">$row.sourcetype$</set>
        <set token="tkn_value">$row.Name$</set>
      </change>

・・・
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...