All Apps and Add-ons

How to use the extracted field expressions using rex command ?

Real_captain
Path Finder

HI 

Can someone please let me know how I can use the below expression (generated via Field Extraction) directly via Rex command: 

Regular expression generated via Field extraction:

 

^(?:[^,\n]*,){7}\s+"\w+_\w+_\w+_\w+_\w+":\s+"(?P<POH>[^"]+)

 

Real_captain_1-1728224376355.png

Real_captain_0-1728224337078.png

I am using the rex command as below but i am getting an error : 

 

| rex field=Message mode=sed "(?:[^,\n]*,){7}\s+"\w+_\w+_\w+_\w+_\w+":\s+"(?P<POH1>[^"]+)"

 

Labels (1)
0 Karma

inventsekar
SplunkTrust
SplunkTrust

Hi @Real_captain , the mode=sed was not from the field extraction wizard. may i know why you thought to use the mode=sed, pls suggest. 


As you can see, 

Syntax: mode=sed Description: Specify to indicate that you are using a sed (UNIX stream editor) expression. sed-expression Syntax: "<string>" Description: When mode=sed, specify whether to replace strings (s) or substitute characters (y) in the matching regular expression. 

https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex#Syntax


not sure, but lets try:

 

| rex field=Message "(?:[^,\n]*,){7}\s+"\w+_\w+_\w+_\w+_\w+":\s+"(?P<POH1>[^"]+)"

 

 

Sample log lines will be helpful to troubleshoot this, thanks.  

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...