Splunk Search

How to extract last words?

akshayinnamuri
Loves-to-Learn Lots

Hi I have sample like this

Source                                                                      
Sample time from tx-templated               
efghi examl from templated                        
Sample time from [templated]       

I want to extract the the values of last word as show below 

Source                                                                  Extract Value
Sample time from tx-templated               tx-templated
efghi examl from templated                        templated
Sample time from [templated]                   templated           

 

how to do via regex?

 

Thanks in advance for help

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<lastword>[\w-]+)\W*?$"
0 Karma
Get Updates on the Splunk Community!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...