Splunk Search

count the number of KEYWORD

abhayneilam
Contributor

Hi,

I have a file which contains :

HI
bye
HI
hi
BYE

I would like to know how many HI is there in my file which would look like

Hi 3 times
BYE 2 times

0 Karma

kristian_kolb
Ultra Champion

Are they in a field? If so, then it is easy to just make use of the stats command.

your_search | stats count by fieldname

where fieldname is the name of your field.

The result would look like;

fieldname   count
HI          2
hi          1
bye         1
BYE         1

Please provide better samples, to get better help.

/Kristian

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...