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!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...