If I wanted a count of all the events in all my indices, I can just do:
index=* | stats count, which just returns a single number in a single row with this value.
But say I wanted to customize the stats function - say I want to add 2 to the count returned:
index=* | stats count+2 is invalid.
How can I customize an aggregate statistics function with simple math operations?
| metasearch index=* | stats count | eval count='count'+2
You need to use an
eval to do basic mathematical calculations
Metasearch will look at your index time fields and search 10x faster than doing
In the Splunk community, users accept answers that helped them solve their problem. This signals a correct answer for users who may look at this in the future. Since both answers are valid, it's fair to accept the one that helped more and/or who answered first, which in this case is this one.
Top contributors on this forum would also be reluctant to answer your future questions if your known not to accept the correct answers