Splunk Search

Reg Expression to find middle charatcter

ashokapex
Explorer

Hi ,
I am new in splunk, i need to find some letter from text using Reg: ex.
how i can do.

i have to find text after Channel , (BLACKROCK) only i dont want to find other text
and this text can chnage, i only know after channel and before trader??

i am using this , but taking every thing after BlackRock ,rex field=_raw "channel (?.*)"

channel BLACKROCK** trader null, new version is 4 new status is Timed Out (Client)
Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

your base search | rex "channel (?<YourField>\w+)"

OR

your base search | rex "channel (?<YourField>\S+)"

OR

your base search | rex "channel (?<YourField>[^\s]+)"

Update
For multiple fields (assuming status is complete string from "new status is " to the end)

   your base search | rex "channel (?<YourField>\S+)([^,]+), new version is (?<version>\S+) new status is (?<status>.*)"

View solution in original post

0 Karma

somesoni2
Revered Legend

Try something like this

your base search | rex "channel (?<YourField>\w+)"

OR

your base search | rex "channel (?<YourField>\S+)"

OR

your base search | rex "channel (?<YourField>[^\s]+)"

Update
For multiple fields (assuming status is complete string from "new status is " to the end)

   your base search | rex "channel (?<YourField>\S+)([^,]+), new version is (?<version>\S+) new status is (?<status>.*)"
0 Karma

ashokapex
Explorer

Nice cool, how we can do multiple field.

rex field=_raw "channel (?\S+) new status is (?.*) "

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...