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!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

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