Splunk Search

一定数値の範囲の数をカウントしたい

tonakano
Engager

ご教授ください。

今日の日付とデータの日付を比較し、差分(何日間)をdurationという名前で抽出ししました。
このdurationを一定の範囲の数をカウントしてビジュアライズしたいと考えたのですが、この範囲カウントが出来ませんでした。

・やりたいこと
duration 0~100 x個
duration 100~365 y個
duration 365~ z個
->x,y,zを棒グラフにしたい

stats countなどでもやれるかと思ったのですが、うまくいきませんでた。

0 Karma
1 Solution

HiroshiSatoh
Champion

レンジの値が100毎とかならBINを使う等も可能だと思いますが規則性がないならCASEを使ったほうがわかりやすいと思います。

 eval rang=case(duration<=100,"duration100",duration<=365,"duration365",1=1,"duration365over")
|stats count by rang

View solution in original post

0 Karma

HiroshiSatoh
Champion

レンジの値が100毎とかならBINを使う等も可能だと思いますが規則性がないならCASEを使ったほうがわかりやすいと思います。

 eval rang=case(duration<=100,"duration100",duration<=365,"duration365",1=1,"duration365over")
|stats count by rang
0 Karma

tonakano
Engager

ありがとうございます。無事出来ました!

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...