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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...