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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...