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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...