Help us understand the problem. What is going on with this article?

Splunk Table colorと閾値の関係

ダッシュボードを作る時に、SPLのevalとtable表示のときの色の閾値の関連がわかりづらいので忘備録として

reference:https://docs.splunk.com/Documentation/Splunk/latest/Viz/TableFormatsXML

ダッシュボード

table
<dashboard>
  <label>table color test</label>
  <row>
    <panel>
      <table>
        <search>
          <query>| makeresults count=30
| streamstats count as delta
| eval delta = delta - 20
| eval colormap=case(delta &lt; -10,"red", -5 &gt; delta AND delta &gt;=-10,"orange", delta &lt; 0 AND delta &gt;= -5,"yellow", delta &gt;= 0 AND delta &lt; 5,"white",delta &gt;= 5, "green")</query>
          <earliest>0</earliest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">40</option>
        <format type="color" field="delta">
          <colorPalette type="list">[#DC4E41,#FFA500,#FFFF00,#FFFFFF,#00FF00]</colorPalette>
          <scale type="threshold">-10,-5,0,5</scale>
        </format>
      </table>
    </panel>
  </row>
</dashboard>

SPL

spl
| makeresults count=30
| streamstats count as delta
| eval delta = delta - 20
| eval colormap=case(delta < -10,"red", -5 > delta AND delta >=-10,"orange", delta < 0 AND delta >= -5,"yellow", delta >= 0 AND delta < 5,"white",delta >= 5, "green")

colorpalette

colorpalette
        <format type="color" field="delta">
          <colorPalette type="list">[#DC4E41,#FFA500,#FFFF00,#FFFFFF,#00FF00]</colorPalette>
          <scale type="threshold">-10,-5,0,5</scale>
        </format>

一覧表

case color 閾値 palette
X < -10 -11,-12 red - #DC4E41
-10<= X < -5 -10,-5 orange -10 #FFA500
-5 <= X < 0 -2,-1 yellow -5 #FFFF00
0 <= X < 5 0,2 white 0 #FFFFFF
5 <= X 5,7 green 5 #00FF00

閾値が以上ということがわかる

まとめ

Splunkのバージョンが8以上だと、ifだけでなくcaseも使える。
Splunk>Answersの例
ただ、別なフィールドの値で判定とかできないような感じです。
数字の範囲の場合、SimpleXMLの場合は以上、GUIでやるときには左の値以上と認識していれば大丈夫だと思います。

toshikawa
Splunkでいろいろやっています。 もっといい方法があったらぜひ教えてください
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした