Splunk Search

How to get the values for the selected fields

Maniteja81
New Member

Hi Guys,

I have this query with me.

index=qvmr_soc_r job_type=batch |stats dc() as * | fields *vip snps | transpose

Basically i'm checking the field names that matches with these vip and snps names.

But this query is only returning the distinct count not the values of the fields.

How to get these values for the specified fields. Any help would be appreciated.

Thanks,
Maniteja

Tags (1)
0 Karma

somesoni2
Revered Legend

Try like this

index=qvmr_soc_r job_type=batch  | fields *vip* *snps* | fieldsummary maxvals=1| table field
0 Karma

aholzer
Motivator

What you are looking for is | stats values(vip) as VIPs values(snps) as SNPS rather than dc().

This will give you the full list of distinct values in those fields as an multivalue field. Read here for more info.

Hope this helps

0 Karma

lakshman239
Influencer

You have to use fields before stats. something like

index=qvmr_soc_r job_type=batch |fields vip snps | stats dc(vip) as vip_dc_count dc(snps) as snps_dc_count |  transpose
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...