Splunk Search

statsコマンドで計算した結果の上位何件だけを表示させる方法について

70250939
Explorer

indexに"count"というフィールドがあり、"user"ごとに"count"を合計を出し、数が多い順に表示させています。

|stats sum(count) by user
|sort - sum(count)

数が少ないひとは除外したいため、数が多い上位10名だけ表示させたいとした場合、どのようなコマンドを使えばよろしいでしょうか?
topコマンドなど使用してみたりしたのですが結果が変わってしまったり、うまく表示されなかったりしています。

いい方法ご存知の方アドバイスよろしくお願いいたします。

Tags (2)
0 Karma

vasanthmss
Motivator

English Version of question:

index to have a field called "count", for each "user" and issued a total of "count", you have to appear in the order number is large.

| stats sum (count) by user
| sort - sum (count)

For human small number you want to exclude, if you want to display only a large number top ten, Are you sure you want if you use any kind of command?
top and I was or try to use such as a command or have changed but a result, we have may not be displayed well.

Better advice thank you for a good way you know.

V
0 Karma

vasanthmss
Motivator

try this,

|stats sum(count) as total by user | sort - total | head 10

Cheers!

V

70250939
Explorer

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

0 Karma

vasanthmss
Motivator

hope this helps you.

V
0 Karma
Get Updates on the Splunk Community!

Index This | What’s a riddle wrapped in an enigma?

September 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

BORE at .conf25

Boss Of Regular Expression (BORE) was an interactive session run again this year at .conf25 by the brilliant ...

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...