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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...