Splunk Search

rex command to extract

sphiwee
Contributor

[2020-07-07 12:40:01+0200] workspace_sandbox RUNNING pid 17159, uptime 21 days, 21:43:58

 

i have this line of log but i want to extract only workspace_sandbox as a field called Services

 

im using rex "(^(?<Service>\s\s\w+.\w+))\s\s" but having no luck. 

 

Also want to extract "Running" as status

 

 

Labels (3)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee ,

please, try this

| rex "\]\s+(?<service>[^ ]+)\s+(?<status>[^ ]+)"

that you can test at https://regex101.com/r/ursNeq/1

Ciao.

Giuseppe

View solution in original post

to4kawa
Ultra Champion

| rex "\]\s(?<Service>\S+) (?<status>\S+)"

 

sphiwee
Contributor

sphiwee_0-1594122964722.png

 

This is what i get, dont think it has to be like this.. any ideas?

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee ,

please, try this

| rex "\]\s+(?<service>[^ ]+)\s+(?<status>[^ ]+)"

that you can test at https://regex101.com/r/ursNeq/1

Ciao.

Giuseppe

sphiwee
Contributor

thanks, you're a legend.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sphiwee ,

You're welcome!

Karma Points are appreciated.

Ciao.

Giuseppe

Tags (1)
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...