Splunk Search

join multiple searches into field values

glennstolz
New Member

I would like to create Cache_Hit, Cache_Miss and Revalidate_Hit based on the below and doisplay them in the pie graph with percentages and count values

Cache_ Hit is when the field event.cache.cacheHit=1 and the field event.cache.cacheStatus!=3
Cache_Miss is when the field event.cache.cacheHit=0 and the field event.cache.cacheStatus=3
Ravlidate_Hit is when the field event.cache.cacheHit=1 and the field event.cache.cacheStatus=3

Tags (1)
0 Karma

to4kawa
Ultra Champion
| makeresults count=20
| eval event.cache.cacheHit=random() % 2
| eval event.cache.cacheStatus=random() % 4
| table event*
| rename COMMENT as "this is sample, check this result"

| stats count(eval('event.cache.cacheHit'=1 AND 'event.cache.cacheStatus'!=3)) as Cache_Hit
, count(eval('event.cache.cacheHit'=0 AND 'event.cache.cacheStatus'=3)) as Cache_Miss
, count(eval('event.cache.cacheHit'=1 AND 'event.cache.cacheStatus'=3)) as Ravlidate_Hit
| transpose 0 column_name=Cache_status
| rename "row 1" as count
0 Karma

glennstolz
New Member

Thank you so much for your reply but I get an error on the makeresults,

My search:
index="akamai-webcdn-afl-app-s"
| makeresults count=20
| eval event.cache.cacheHit=random() % 2
| eval event.cache.cacheStatus=random() % 4
| table event*
| rename COMMENT as "this is sample, check this result"
| stats count(eval('event.cache.cacheHit'=1 AND 'event.cache.cacheStatus'!=3)) as Cache_Hit, count(eval('event.cache.cacheHit'=0 AND 'event.cache.cacheStatus'=3)) as Cache_Miss, count(eval('event.cache.cacheHit'=1 AND 'event.cache.cacheStatus'=3)) as Ravlidate_Hit
| transpose 0 column_name=Cache_status
| rename "row 1" as count

The error:
Error in 'makeresults' command: This command must be the first command of a search.

0 Karma

to4kawa
Ultra Champion
0 Karma
Get Updates on the Splunk Community!

Index This | What did the zero say to the eight?

June 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...