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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...