Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
MEDHA07
Contributor III
Contributor III

Text file read

Hi All,

 

I have log files data which is in .text format.I have 4 different folders and it will have the logs.

Root/

folder 1/

log.1

log.2

folder 2/

log.1

log.2

Now i want to go to each folder and read the each log file need to get specific formatted line.

Example:Line start with the timestamp and in middle i have key manager:85 which is common for all logs then will get request id:

I need the last request id from the line from all logs.

2021-08-17 00:00:01 ############# Manager:85 process request id :12345

2021-08-17 01:00:01 ############# Manager:85 process request id :7474794

2021-08-16 12:00:01 ############# Manager:85 process request id :789494    

 

 

1 Reply
Vegar
MVP
MVP

What is the issue you need help with is it to loop through the folders and files or is it extraction the rows from the files.

You can create a loop for your folders and files using the For each vfolder in dirlist(...) next and For each vfile in filelist(...) next statements. 

Fetching the id from each row in the files you can use the following load statement.

Let vSearchString = 'Manager:85 process request id :';
LOAD
  mid(LOGTXT,index(LOGTXT, '$(vSearchString)')+len('$(vSearchString)')) as [Process request id] 
FROM
  LogFile
;