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!

Splunk Enterprise Security 8.0.2 Availability: On cloud and On-premise!

A few months ago, we released Splunk Enterprise Security 8.0 for our cloud customers. Today, we are excited to ...

Logs to Metrics

Logs and Metrics Logs are generally unstructured text or structured events emitted by applications and written ...

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...