Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Splunk 7 Essentials, Third Edition

You're reading from   Splunk 7 Essentials, Third Edition Demystify machine data by leveraging datasets, building reports, and sharing powerful insights

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788839112
Length 220 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Erickson Delgado Erickson Delgado
Author Profile Icon Erickson Delgado
Erickson Delgado
Steven Koelpin Steven Koelpin
Author Profile Icon Steven Koelpin
Steven Koelpin
J-P Contreras J-P Contreras
Author Profile Icon J-P Contreras
J-P Contreras
Betsy Page Sigman Betsy Page Sigman
Author Profile Icon Betsy Page Sigman
Betsy Page Sigman
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Splunk – Getting Started FREE CHAPTER 2. Bringing in Data 3. Search Processing Language 4. Reporting, Alerts, and Search Optimization 5. Dynamic Dashboarding 6. Data Models and Pivot 7. HTTP Event Collector 8. Best Practices and Advanced Queries 9. Taking Splunk to the Organization

Search command – stats

A common use of the stats command is to count events. To see how this works, run the following search query. The SPL will return a single number representing the count of all events in the last 30 minutes. Notice that the pipe that precedes the stats command filters the data that will be included in the final count:

SPL> index=main earliest=-30m latest=now | stats count 

Change the time modifier and the number should be reduced:

SPL> index=main earliest=-15m latest=now | stats count 

You may be wondering where the count came from. The true format of a stats command is stats function(X). This asks the system to return the result of the function based on the field X. When the count function is used without parentheses, Splunk assumes that you are looking for the count of all events in the given search.

The stats command becomes a very powerful...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image