0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Splunk: ダッシュボードの検索結果からサーチや別のダッシュボードへリンクする

Posted at
実施環境: Splunk Free 8.2.2

0. 概要

Splunk のダッシュボードにおいて、検索結果をもとにサーチを実行したり、別のダッシュボードにリンクしたりしたい場合があります。
そのようなときに利用する機能が、ドリルダウンです。
今回はそのドリルダウンという機能について紹介していきます。

1. ダッシュボードへのリンク

例えば、以下のリンク元ダッシュボードの検索結果をもとにリンク先ダッシュボード( ID : dashboard_link )へリンクさせたいとします。

WS000202.JPG

<dashboard>
  <label>リンク元ダッシュボード</label>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults count=1
| eval link="dashboard_link"
| eval index="_audit"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</dashboard>

WS000203.JPG

<form>
  <label>リンク先ダッシュボード</label>
  <fieldset submitButton="false">
    <input type="text" token="text_token">
      <label>インデックス名</label>
      <default>_internal</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <chart>
        <search>
          <query>index="$text_token$"
| timechart span=1h count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">none</option>
      </chart>
    </panel>
  </row>
</form>

まずは、リンク元のダッシュボードの検索結果パネルの右上の「その他のアクション」から「ドリルダウンを編集」を選択します。

WS000205.JPG

ドリルダウンエディターが開くので、以下の設定を入力します。

項目
クリック時 ダッシュボードにリンク
App Search & Reporting
ダッシュボード リンク先ダッシュボード
新しいタブで開く チェックを入れる

WS000206.JPG

これで表をクリックすると、リンク先ダッシュボードが新しいタブで開きます。

WS000212.JPG

WS000203.JPG

ちなみに今回は表にリンクを付与していますが、他の棒グラフや折れ線グラフなどでもリンクを付与することが可能です。

2. ダッシュボードの入力

リンク時にダッシュボードの入力も指定できます。
ダッシュボードの入力を指定する場合は、ドリルダウンエディターの「詳細」⇒「パラメータ」で指定します。

WS000207.JPG

入力に検索結果のフィールド値を入れたい場合は、以下の形式で指定します。

form.<入力のトークン名>=$row.<フィールド名>$

今回は、form.text_token=$row.index$と指定します。

これで表をクリックすれば、リンク先のダッシュボードで入力にフィールド index の値が入ります。

WS000208.JPG

3. リンク先ダッシュボードの変更

クリック時を「カスタム URL にリンク」にすれば、リンク先のダッシュボードを可変にすることもできます。
フィールド値の指定方法は先ほどの入力と同じです。

今回は URL に /app/search/$row.link$?form.text_token=$row.index$ と指定してみます。

WS000209.JPG

これで、 link フィールドに指定した ID のダッシュボードに移動できます。

4. サーチへのリンク

ダッシュボードではなく、個別のサーチへのリンクも設定可能です。
サーチへのリンクを付与する場合は、「クリック時」を「サーチにリンク」の「カスタム」にします。
フィールド値の指定方法は先ほどの入力と同じです。

今回はサーチ文字列に index="$row.index$" と指定してみましょう。

WS000210.JPG

これで表をクリックすると、サーチ画面に移動することができます。

WS000211.JPG

5. その他のリンク

カスタム URL には http://~という形の絶対 URL も指定できるので、ダッシュボードやサーチ以外へのリンクも指定可能です。
例えば、 https://www.bing.com/search?q=$row.index$ と指定してみましょう。

WS000214.JPG

これで表をクリックすると、 bing の検索画面に移動することができます。

WS000215.JPG

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?