Splunk Search

How can I show the fields which have a specific value?

ddrillic
Ultra Champion

I'm running the following - index=<claims_index> geico | table *. This index has around 200 fields and I would like the query to show only the fields which have geico in them. Is it possible?

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this workaround.

index=<claims_index> geico | eval temp=_time | fields - _* | eval _time=temp | fields - temp| table _time *
| untable _time fieldname fieldvalue | where match(fieldvalue,"geico") | xyseries _time fieldname fieldvalue

View solution in original post

0 Karma

somesoni2
Revered Legend

Try this workaround.

index=<claims_index> geico | eval temp=_time | fields - _* | eval _time=temp | fields - temp| table _time *
| untable _time fieldname fieldvalue | where match(fieldvalue,"geico") | xyseries _time fieldname fieldvalue
0 Karma

ddrillic
Ultra Champion

Not sure if I can grasp it ; -)

Formatted a bit -

index=<claims_index> geico 
| eval temp=_time 
| fields - _* 
| eval _time=temp 
| fields - temp
| table _time *
| untable _time fieldname fieldvalue 
| where match(fieldvalue,"geico") 
| xyseries _time fieldname fieldvalue

This claims_index is huge and since we search explicitly for geico, the query is very slow. Is there a way to see intermediate results? It can run for many hours...

0 Karma

somesoni2
Revered Legend

There are some element in the query to clean fields (remove all _ fields but preserve _time), so looks weird.

YOu can reduce the time range and/or add a head command after the base search to process only few rows for testing.

index=<claims_index> geico  | head 1000
 | eval temp=_time 
 | fields - _* 
 | eval _time=temp 
 | fields - temp
 | table _time *
 | untable _time fieldname fieldvalue 
 | where match(fieldvalue,"geico") 
 | xyseries _time fieldname fieldvalue
0 Karma

ddrillic
Ultra Champion

So, I ran the following -

index=<claims_index>  geico
 | head 50
 | eval temp=_time 
 | fields - _* 
 | eval _time=temp 
 | fields - temp
 | table _time *
 | untable _time fieldname fieldvalue 
 | where match(fieldvalue,"geico") 
 | xyseries _time fieldname fieldvalue

It finished and said - 50 events (before 4/13/17 10:35:24.000 AM) but no results are shown.

0 Karma

somesoni2
Revered Legend

Can you run the query in parts and see which step the data goes away? (run everything before untable and then keep adding rest)

0 Karma

ddrillic
Ultra Champion

Perfect - I'll do so...

0 Karma

ddrillic
Ultra Champion

Let me accept it meanwhile ; -) much much appreciated!!!!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...