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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...