Splunk Search

How to "loop" or repeat a search with all values of a field to generate a table?

SrishtiPalani
Engager

Hello,

How to "loop" or repeat a search with all values of a field to generate a table and count the values? I have tried foreach and map, but I believe I'm not using the syntax correctly. Thank you!

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi SrishtiPalani,
try something like this:

| inputlookup tiers.csv 
| makemv tiers
| rex field=tiers "\d\=(?<single_tiers>[^ ]*)"
| nomv tiers
| stats values(tiers) AS tiers by single_tiers

Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi SrishtiPalani,
try something like this:

| inputlookup tiers.csv 
| makemv tiers
| rex field=tiers "\d\=(?<single_tiers>[^ ]*)"
| nomv tiers
| stats values(tiers) AS tiers by single_tiers

Bye.
Giuseppe

niketn
Legend

@SrishtiPalani, how many distinct APPs you have in total? How will you get the distinct APP names(is it from the same lookup file)?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
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 ...