Splunk Search

Extracting a composite variable and comparing it with the rows of an index.

omcollia
Engager

"I have an issue with creating a field named 'Path' which should be populated with 'YES' or 'NO' based on the following information:

I have fields like 'Hostname', 'dev', and 'vulnerability'. I need to take the values in 'dev' and 'vulnerability' and check if there are other rows with the same 'hostname' and 'vulnerability'. If there is a match, I write 'NO' in the 'Path' field; otherwise, I write 'YES'."

Hostname 

devvulnerabilita patch
ABapache SI
ABsqlNO
B0apache NO
B0pythonNO
C A apacheSI
Labels (4)
0 Karma

omcollia
Engager

"I will have a table composed of Hostname, Dev (hostname of the development machine associated with the machine in the Hostname field), vulnerability (vulnerability associated with the machine in Hostname). The Dev field is only used to see if the machine in Hostname has a machine in development associated with it. I should verify that in my table there is not that machine (in this case in the hostname field) associated with the same vulnerability."

HOSTNAMEDEVVULNERABILITà
PAPERINOpippoAPACHE


In this case, my machine "paperino" has a vulnerability "apache", and it also has a development machine associated with it. Therefore, I should verify that for the machine "Pippo" there isn't the same vulnerability


HOSTNAMEDEVVULNERABILITà
PIPPO-APACHE


If this row were present in my search, then in the row of the table above, I should write "YES" in my new field that I will create. because pippo have same vulnerability (apache )

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Thanks for a clearer description of your usecase

Please try this

| eventstats values(Hostname) as hosts by vulnerability
| eval patch=if(isnotnull(mvfind(hosts,dev)), "Yes", "No")
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear whether you are matching hostname and vulnerability or dev and vulnerability. In either case, your table doesn't appear to have any rows where patch should be NO (according to your logic). Please can you clarify your requirement.

If the table was supposed to be the result, rather than the events, please can you share some sample events.

0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...