File log iterate with various list with inclusion and exlusions

We buiild many packages which produces their standard Text log files.  What I will like to do is perform a process job on the each file that is in this folder and look for a certain string variable.  For example (Warning, Error, Fatal, Failed)  If the line has one of these string  values, I would the like to perform a iterate on the line as an exlusion to what was found. For examplle if warning is found, I want to remove "Warning ... 5200" if that line existed.  This way I would list out all other warnings. Same holds true to the other items listed. 

Then the results I would like to store in a variable location appropriate to what was found.  All warnings in the warning variable.  Then we will email and dump the result to the logs file and send via email!

Reason why we split up the issues is due to the fact that certain items we can ignore and some items we have to investigate, but some of those are not fatal to our build process.

Other items I am looking at is in the various logs, how far back a certain item has been listed.  Most of our files are Date Time stamped within the log files. So I think I can do a count back from today's date and find that set of files.

Any guidance is greatly appreciated.  We have done most with  windows scripting but we are moving this function to utilize Finalbuild and the actions that may come with it.

Thanks in advance!

Hi Dennis,

We're actually working on some features to help with this kind of thing in the next major release, but that won't be for a while.

I've enclosed a quick project showing how to use the OnStatusMessage event of an action to filter out certain keywords. You could build on this to make a system like the one you describe.

 

If you need to use it across multiple actions, I suggest putting a script function into the Project Global Script and calling it from the OnStatusMessage event of each action.

 

Also, I'm just using string.indexOf() to match errors and warnings in my example. You may need to expand that to use regular expression matching, in order for it to be less haphazard.

 

Regards,

Angus

Filter out warnings.fbz5 (1.791 KB)

Dennis,

One after-thought, if you need to process all action output, or arbitrary log files, then you can use the File Contents Iterator and/or export the FB log file to XML and use the XML Node Iterator.

Regards,

Angus

Thanks, We will look at this once time permits