Splunk Search

How to search a string

RGullur
New Member

Hi Community, please help me how to extract BOLD/underlines value from below string:

[2025-01-22 13:33:33,899] INFO Setting connector ABC_SOMECONNECTOR_CHANGE_EVENT_SRC_Q_V1 state to PAUSED (org.apache.kafka.connect.runtime.Worker:1391)

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Combining everyone's suggestions, here is a command that is ready to go if that string is all you need:

| rex "Setting connector (<myfield>\S+)"

How strictly or loosely you want to set anchors and matches heavily depends on actual data and use case.  This is just something to get you started.

0 Karma

isoutamo
SplunkTrust
SplunkTrust
regex101.com is excellent place to try how these rex are working or not. It also show execution cost of different versions and contains some other help.

bowesmana
SplunkTrust
SplunkTrust

As @dural_yyz says, the regex is easy - you can use this with the rex command

https://docs.splunk.com/Documentation/Splunk/9.4.0/SearchReference/rex

 

0 Karma

dural_yyz
Motivator

The regex is simple enough.

^.*\sSetting\sconnector\s(?<connector_event>[^\s]+).*$
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Anchoring the regex to the beginning of the string is not needed and actually significantly impacts the performance (match in 154 steps vs. 29 without the "^.*" part).

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...