Dashboards & Visualizations

rex to extract the key value

vikashperiwal
Path Finder

HI,

 

I am triying to use value from the below log in drop down and then filter based on this  value in panel. 

how can i extract this , please guide

Drop Down:

Field_ID

umt_nic_rbg_config.json

mrd.json

rbg_config.json

nic_rbg_config.json

/apps/dat/smrdau/xyz/mrd/temp/umt_nic_rbg_config.json_bu1595098800

/apps/dat/amrdau/xyz/mrd/temp/mrd.json_date=202

/apps/dat/amrdu/xyz/mrdap-ingestion/temp/rbg_config.json_business

/apps/dat/amrdau/xyz/mrdap/temp/nic_rbg_config.json_bdate=2020

 

 

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

niketn
Legend

@vikashperiwal try the following Reg Ex based approach with a run anywhere example that you can change with your SPL. Essentially just try the following regex | rex field="Field_ID" ("?<Field_ID>[^|\/]+.json"). If the regex does not work you may have to further test and modify regex as per your actual data as the following regex is based only on the sample data provided in the question.

 

| makeresults
| fields - _time
| eval Field_ID="umt_nic_rbg_config.json;mrd.json;rbg_config.json;nic_rbg_config.json;/apps/dat/smrdau/xyz/mrd/temp/umt_nic_rbg_config.json_bu1595098800;/apps/dat/amrdau/xyz/mrd/temp/mrd.json_date=202;/apps/dat/amrdu/xyz/mrdap-ingestion/temp/rbg_config.json_business;/apps/dat/amrdau/xyz/mrdap/temp/nic_rbg_config.json_bdate=2020"
| makemv Field_ID delim=";"
| mvexpand Field_ID
| rex field="Field_ID" ("?<Field_ID>[^|\/]+.json")

 

 

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@vikashperiwal try the following Reg Ex based approach with a run anywhere example that you can change with your SPL. Essentially just try the following regex | rex field="Field_ID" ("?<Field_ID>[^|\/]+.json"). If the regex does not work you may have to further test and modify regex as per your actual data as the following regex is based only on the sample data provided in the question.

 

| makeresults
| fields - _time
| eval Field_ID="umt_nic_rbg_config.json;mrd.json;rbg_config.json;nic_rbg_config.json;/apps/dat/smrdau/xyz/mrd/temp/umt_nic_rbg_config.json_bu1595098800;/apps/dat/amrdau/xyz/mrd/temp/mrd.json_date=202;/apps/dat/amrdu/xyz/mrdap-ingestion/temp/rbg_config.json_business;/apps/dat/amrdau/xyz/mrdap/temp/nic_rbg_config.json_bdate=2020"
| makemv Field_ID delim=";"
| mvexpand Field_ID
| rex field="Field_ID" ("?<Field_ID>[^|\/]+.json")

 

 

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

vikashperiwal
Path Finder

This is exactly what i was looking for..... Thank you very much .. @niketn 

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...