Getting Data In

I have a Log file where different .TXT files are present. How can I extract a field with the help of regular expression for all .TXT files are present ?

saibal6
Path Finder

;1;1;;;File not found : D:\WINDOP\COMS\WINDOP\IN\UPDATE.TXT
;3;1;;;File not found : D:\WINDOP\COMS\WINDOP\IN\STORE.TXT
;1;0;0;;D:\WINDOP\COMS\WINSDOP\IN\PROD.TXT
;1;0;2;;D:\WINDOP\COMS\WINSDOP\IN\MTPRO.TXT
;0;3;0;;D:\WINDOP\COMS\GARIA\IN\1449\CARDDOLD.TXT

Tags (1)
0 Karma

niketn
Legend

Try the following rex command for field extraction. You can use regex101.com for testing regular expression with your sample data:

 <yourBaseSearch>
| rex "(?<fqdnFile>\w\:[^\.]+\.TXT)$"

Following is the run anywhere example base d on sample data provided (commands from makeresults till rename are used to generate sample data):

| makeresults 
| eval data=";1;1;;;File not found : D:\WINDOP\COMS\WINDOP\IN\UPDATE.TXT|;3;1;;;File not found : D:\WINDOP\COMS\WINDOP\IN\STORE.TXT|;1;0;0;;D:\WINDOP\COMS\WINSDOP\IN\PROD.TXT|;1;0;2;;D:\WINDOP\COMS\WINSDOP\IN\MTPRO.TXT|;0;3;0;;D:\WINDOP\COMS\GARIA\IN\1449\CARDDOLD.TXT" 
| makemv data delim="|" 
| mvexpand data
| rename data as _raw
| rex "(?<fqdnFile>\w\:[^\.]+\.TXT)$"
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...