Splunk Search

How to extract the substring from a string

febbi
Explorer

I want to extract the substring: "xenmobile" from string:  "update task to xenmobile-2021-11-08-19-created completed!", how can I get that?

Labels (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust
| makeresults
| eval foo = "update task to xenmobile-2021-11-08-19-created completed!"
| rex field=foo "update task to (?<bar>[^-]+)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| replace "xenmobile" WITH "" IN field
0 Karma

isoutamo
SplunkTrust
SplunkTrust
| makeresults
| eval foo = "update task to xenmobile-2021-11-08-19-created completed!"
| rex field=foo "update task to (?<bar>[^-]+)"
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...