How to get particular information from log file

Four Stars

How to get particular information from log file

Hi, 

We have source log file as below:

(Please note its not delimited file)

12/31/2017 23:38:59.335-06:00 DB_firstValue 11,196

Table Count Thread Oldest entry
---------- ---------- ---------- ------------ --------
Table1 6,437 1 12/31/17 03:02:04
Table2 1,548 1 12/31/17 03:24:10
Table 1,123 1 12/31/17 03:24:10
tbl 871 1 12/31/17 03:02:07
abc_tbl 99 1 12/31/17 03:12:37

 

 

expected output file is:

Report Run DateReport Run TimeDatabase NameTable NameOldest Trans DateOldest Trans Timestampcount
12/31/201723:38:59DB_firstValueTable11 12/31/173:02:046,437
12/31/201723:38:59DB_firstValueTable21 12/31/173:24:101,548
12/31/201723:38:59DB_firstValueTable1 12/31/173:24:101,123
12/31/201723:38:59DB_firstValuetbl1 12/31/173:02:07871
12/31/201723:38:59DB_firstValueabc_tbl1 12/31/173:12:3799

 

 

Please suggest how we can achieve this by talend job.

 

Source file attached for reference.

 

Regards

Kanchan

 

 

 

 

 

 

 

 

Moderator

Re: How to get particular information from log file

Hello,

You can use talend Stat&Log feature in your job work flow.

tStatCatcher, Statistics table records details like begin Time, End Time which is generated by any job.
tLogCatcher, Logs table records the messages from Java Exception, tDie and/or tWarn (prerequisite: there must be an error in your job).
tFlowMeterCatcher, Flow Meter table records the number of rows processed in the defined flow(prerequisite: you have to use tFlowMeter in your job).
Here are related online documents about:TalendHelpCenter:tStatCatcher, TalendHelpCenter:tFlowMeterCatcher and TalendHelpCenter:tFlowMeter

Let us know if it is what you are looking for.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: How to get particular information from log file

Hi,

 

These solution are for log and errors, i can use these component once file read is done but i am facing issue to read the file as well, as file is not delimited one.

 

Attached file for reference(source- file1.txt, target-out.xlsx), please let me know for further.

 

 

Moderator

Re: How to get particular information from log file

Hello,

Please have a look at this component tFileInputRaw with the option 'Read the file as a string' which can read all data in a raw file and sends it to a single output column for subsequent processing by another component.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: How to get particular information from log file

I was able to do something like this using: tFileInputFullRow ---> tMemorizeRows ---> tJavaFlex Read in your file and pass the 'main' to tMemorizeRows. Now you can use java code in tJavaFlex.