Focal Point
[CLOSED]Text file data source

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3807074086

January 26, 2016, 02:18 PM
Jwoodard
[CLOSED]Text file data source
I have been asked to create a WebFOCUS report against an application log file. I doubt that this is possible.

I think I would need to set up a process to create and update a table using the contents of the log file. Then configure a synonym for the new table, etc.

Any comments or suggestions about the feasibility of this approach will be appreciated.

Thanks

This message has been edited. Last edited by: <Emily McAllister>,


7.703 Windows
8.009
January 26, 2016, 02:34 PM
BabakNYC
Do you know what the application log file looks like? If you can identify each column in the log file, you can create a synonym (master file) for it and report off of it. Unfortunately, most log files aren't really well structured so that's what makes the process a lot more labor intensive.


WebFOCUS 8206, Unix, Windows
January 26, 2016, 03:21 PM
Waz
The simplest way to read a log file is to use a master file that has a single field in it to read each row, then you can break it up with DEFINES, etc.

If it is structured, then a more complex master can be created.

e.g.
EX -LINES * EDAPUT MASTER,LOG,CV,FILE
FILENAME=LOG, SUFFIX=FIX,$
SEGNAME=LOG, $
  FIELD=LINE ,ALIAS=  ,A255 ,A255 ,$
EDAPUT*

EX -LINES * EDAPUT FOCTEMP,LOG,CV,FILE
The Quick Brown Focus Jumped Over The Lazy SQL
EDAPUT*

FILEDEF LOG DISK log.ftm

-RUN

TABLE FILE LOG
PRINT *
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 27, 2016, 01:44 PM
Jwoodard
Thanks BabakNYC and Waz,

I used Waz's guidelines.

I created a synonym using the text editor

Synonym Name: LogTest

FILENAME=ErrorLogTest, SUFFIX=FIX,$
SEGNAME=ErrorLogTest, $
FIELD=LINE ,ALIAS= ,A255 ,A255 ,$

I placed the ErrorLogTest log file in the baseapp folder as ErrorLogTest.ftm

I created a procedure:

FILEDEF LogTest DISK baseapp/ErrorLogTest.ftm
-RUN
TABLE FILE LogTest
PRINT *
END

I can run the procedure and it shows every line in the ErrorLogTest.ftm file. So now I need to find a way to filter ErrorLogTest.ftm so that when my procedure runs it only shows the errors that I am looking for.


7.703 Windows
8.009
January 27, 2016, 01:54 PM
RSquared
If you can load the file into either a CSV or Excel file, you can then add it to WF as a synonym using the new / upload feature In the Master File folder.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
January 27, 2016, 01:59 PM
BabakNYC
I haven't tested it in an FTM but you could try setting a FILTER in the master file that tests if LINE has the word error in it.
FILTER ERR_TEST=LINE CONTAINS 'Error'; $

then have a WHERE ERR_TEST EQ 1;

in your focexec.


WebFOCUS 8206, Unix, Windows
January 27, 2016, 04:15 PM
Jwoodard
That worked perfectly Babak. Thanks for that.

I will look into the Master File upload feature, had not heard of that before.

Thanks, problem solved.


7.703 Windows
8.009
January 28, 2016, 10:31 AM
RSquared
Take a look in Creating Reporting Applications With Developer Studio > Creating a Reporting Application > Uploading Data Files


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
January 29, 2016, 10:21 AM
Jwoodard
Babak,
How do you add multiple conditions to that FILTER statement? Can you use AND, OR?


7.703 Windows
8.009
January 29, 2016, 10:27 AM
BabakNYC
Looks like you can. I just tried this filter in car file and got what I expected.

FILTER TEST=COUNTRY CONTAINS 'ENG' OR COUNTRY NE 'FRANCE'; $


WebFOCUS 8206, Unix, Windows
February 02, 2016, 04:01 PM
Jwoodard
Thanks,

I found that this works in the FEX to do multiple conditions on the filter

WHERE ERR_TEST EQ 1;
WHERE LINE CONTAINS '10/29/2015';

What I need to do now is find out how to replace 10/29/2015 with today's date and time.


7.703 Windows
8.009
February 02, 2016, 04:30 PM
jcannavo
I would think you'd just setup a define like such:

DT_TODAY/MDYY='&DATEMDYY';

Then within your WHERE clause replace '10/29/2015' with DT_TODAY.

-Joe


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
February 02, 2016, 04:32 PM
BabakNYC
quote:
WHERE LINE CONTAINS '10/29/2015';


Take a look at &DATEDMYY.

WHERE LINE CONTAINS '&DATEDMYY';


WebFOCUS 8206, Unix, Windows
February 02, 2016, 04:40 PM
Waz
Really wanted to click a LIKE button then


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!