Splunk Enterprise Security

How to separate field values from a single field into two unique values?

Splunkuser542
Explorer

Hi,

Using the following event log which has not been extracted, is it possible to seperate the current 'Name:' field to two seperate fields so that I can table the two unique values? For example, the first 'Name:' field renamed to 'To:' and the second 'Name:' field renamed to 'From:'.

--- To Details --- 
Name: John Smith
...
...

--- From Details --- 
Name: Bob Marley
...
...

End result:

To         | From
John Smith | Bob Marley
1 Solution

niketn
Legend

@Splunkuser542 , as you might be aware this kind of regular expression extraction depends on pattern before and after the required field value to be extracted. So unless this kind of pattern is not present or explained in your question/sample data, our suggestion might not work for you. Add the following to your search to see if it works:

  <yourCurrentSearch>
 | rex "--- To Details ---\s+Name:\s(?<ToName>.+)"
 | rex "--- From Details ---\s+Name:\s(?<FromName>.+)"

Following is a run anywhere example based on your sample data provided in the question.

| makeresults
| eval _raw=" --- To Details --- 
 Name: John Smith
 ...
 ...

 --- From Details --- 
 Name: Bob Marley
 ...
 ..."
 | rex "--- To Details ---\s+Name:\s(?<ToName>.+)"
 | rex "--- From Details ---\s+Name:\s(?<FromName>.+)"
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

@Splunkuser542 , as you might be aware this kind of regular expression extraction depends on pattern before and after the required field value to be extracted. So unless this kind of pattern is not present or explained in your question/sample data, our suggestion might not work for you. Add the following to your search to see if it works:

  <yourCurrentSearch>
 | rex "--- To Details ---\s+Name:\s(?<ToName>.+)"
 | rex "--- From Details ---\s+Name:\s(?<FromName>.+)"

Following is a run anywhere example based on your sample data provided in the question.

| makeresults
| eval _raw=" --- To Details --- 
 Name: John Smith
 ...
 ...

 --- From Details --- 
 Name: Bob Marley
 ...
 ..."
 | rex "--- To Details ---\s+Name:\s(?<ToName>.+)"
 | rex "--- From Details ---\s+Name:\s(?<FromName>.+)"
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Splunkuser542
Explorer

Thanks @niketnilay - the first solution worked.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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