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!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...