Splunk Search

Set attribute for all elements having a certain ID when 2 values are availabe witin the elements having this id

lukas1
Explorer

Hi everyone,

I try to set an attribute to true for all elements having a certain ID, when 2 defined activities are available for that certain ID.

In my optinion the corresponding SQL query would be:

  Update t set isvalid = true where id in (select id from t group by id having activity = 'a' and activity = 'b')

 

A result might look like:

idactivitiyistrue
001atrue
001btrue
001ctrue
002afalse
002cfalse
002dfalse
003atrue
003btrue

 

Is there an option to execute this in SPL?

 

Thanks,

Lukas

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eventstats values(activity) as activities by id
| eval istrue=if(isnotnull(mvfind(activities,"a")) and isnotnull(mvfind(activities,"b")),"true","false")

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eventstats values(activity) as activities by id
| eval istrue=if(isnotnull(mvfind(activities,"a")) and isnotnull(mvfind(activities,"b")),"true","false")

lukas1
Explorer

Thank you @ITWhisperer !

 

Working now 😀

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...