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!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...