Splunk Enterprise

rex field

Yim
Loves-to-Learn Lots

Hi everyone, 

I am using rex field to extract content that containst the following word: full

 

| rex field=msg_old "(?<msg_keyword>full).*"

 

However, what I actually need is to extract content with the word full alone, not words that contain full in between, just the word full itself. 

Can you please advise if the sentence needs to be different? Thanks

 

Labels (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

a nice place to test regex is regex101.com.

https://regex101.com/r/5maP5V/1 here is one example how this can achieve.

| rex field=msg_old "\b(?<msg_keyword>full)\b"

If you want select only events which have word full in field msg_old then you should try

| regex msg_old = "\bfull\b"

 r. Ismo

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear what you are trying to do. You use "full" in your pattern, but you mention "FULL" in your description. Do you need what is extracted to be changed to uppercase? What do you mean by "not between"? Do you just want the word "full" if it exists in the msg_old field? Please clarify with sample (anonymised) events and a clear description of what you want to extract from where, and under what circumstances. Please also include a representation of what your expected output would look like.

0 Karma

Yim
Loves-to-Learn Lots

Hi ITWhisperer,

For example, with that instruction I am extracting data from msg_old field with the word full in between like: she works successfully for us, but what I need is just data that contain the word word "full" itself. 

For instance: The house is full. 

Hope this can clarify. Thanks.

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Not really. Please provide a sample anonymised event in raw format, in a code block (using the </> button above) to preserve the format of the event. Please indicate which part of the event you want extracted.

0 Karma

Bhumi
Path Finder

Hi @Yim 

Are you trying to extract it from the field or raw data ? 

Please send me the sample data and elaborate it what you are trying to achieve as an output. 

0 Karma

Yim
Loves-to-Learn Lots

 

Hi Bhumi,

For example, with that instruction I am extracting data from msg_old field with the word full in between like: she works successfully for us, but what I need is just data that contain the word word "full" itself. 

For instance: The house is full. 

Hope this can clarify. Thanks.

 

0 Karma
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!

Get Agentic with Splunk Lantern: Connect to Cisco Cloud Control, Transform ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

July Community Events: Master ITSI 5.0 & Automate Splunk

Struggling with alert fatigue or feeling like you're spending more time on infrastructure maintenance than ...

New Release of Federated Search: Bringing Splunk Analytics to More of Your Data

Organizations today are generating more data than ever and storing it across cloud object stores, data lakes, ...