Splunk Search

How to append the result of a search to values of a multivalued field?

buttsurfer
Path Finder

 

I have a SPL search that returns a field with multiple values (names of lookups). I want to concat the lookup name and it's origin app, found with the search below:

      | rest splunk_server=local /servicesNS/-/-/saved/searches | table title eai:acl.app eai:acl.owner search | where match(search,"outputlookup\s+lookupname")

 

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try something like this

| rex max_match=0 field=search "outputlookup\s+(?<lookup>.+)"
| eval lookups=mvjoin(mvappend(title,lookup)," ")
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are two problems with the query.  The first is the table command is removing the lookupname field so there is nothing for match to look for.  The second is Splunk has two concatenation operators: + and . (dot).  IME, dot works better.

| rest splunk_server=local /servicesNS/-/-/saved/searches 
| eval lookupname="incident_settings" 
| eval matchstring="outputlookup\s"+lookupname 
| table title eai:acl.app eai:acl.owner search lookupname 
| where match(search,"outputlookup\s" . lookupname)

A word of caution: the lookup name may not be the first word after outputlookup if the command uses options like append or create_empty.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...