Splunk Search

how can i search an existing value from resultsearch on index?

sfatnass
Contributor

hello everybody,

i'm trying to fetch if a value existing on index or not.

after search result i get a new filtering fields and i want to know if i can use |eval test=if(index,"exist","notexist").

my exemple search::
index=A
|field blabla1 blabla2 blabla3
[dbquery "DB" "select..........." |fields + blabla]
[dbquery "DB" "select .........." |fields + blabla2]

|eval test=if(index=B,blabla3,"KO") ==> here is my problem

if any body have any idea thx

Tags (3)
0 Karma
1 Solution

woodcock
Esteemed Legend

The problem is that you have explicitly discluded the thing you are testing. Your search starts out with index=A so all of your initial results set will have ONLY index values of A. You then later say if(index=B) which will ALWAYS be false. You need to start out with something broader like (index=A) OR (index=B).

View solution in original post

0 Karma

woodcock
Esteemed Legend

The problem is that you have explicitly discluded the thing you are testing. Your search starts out with index=A so all of your initial results set will have ONLY index values of A. You then later say if(index=B) which will ALWAYS be false. You need to start out with something broader like (index=A) OR (index=B).

0 Karma

vganjare
Builder

Can you please explain more about the problem? Try to create an example using _internal index.

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 ...