Using Python to parse Cognos Powerplay cube build log files and send user alert notifications.

One of the activities we leverage python is to parse the Cognos Powerplay cube build log files generated during the cube build process. The python program parses the log files to figure out if the cube build was a success or failure and to sends out user notification.

The program then performs one of two things listed below.

If the cube build was a success, the python program.

  • Parses the log file and extracts the Error codes from it.
  • Cross-references the error codes against available IBM transformer error codes listed in the JSON file to get the error description. 
  • Writes into a file the error code and error description plus the URL link to IBM site which provides more details regarding the error.
  • Then a failure email gets sent to the users along with the above file as an attachment.

If the cube build was a failure, the python program.

  • Writes into a file the cube build start time and total cube buld time.
  • A failure email gets sent to the users along with the above file as an attachment.

I have the programs saved in a folder in my github space, and have also listed the link to them below. Also, i have mentioned a short description of each file below.

PowerplayCubeParser.py

https://github.com/NinjaKullan/How-BI-Works-files/tree/master/Python/Parsing_Cognos_PowerPlay_Cube_Log

This file contains the main python program which performs the activities listed above.

SendUserNotificationEmail.py

This file contains the functions to send emails with attachments. These functions get imported into the main program, which the program then uses to to send notification to the users.

TransformerErrorCode.json

This file contains all the possible cognos powerplay transformer error codes and their short descriptions provided by IBM. I could have used beautiful soup to parse the webpage in IBM site directly rather than cross-referencing a local file. But I wanted to keep it simple and not over complicate things. So just downloaded the error codes as JSON format and stored it locally. 

Let me know if you have any questions or have any issues getting this to work. 

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s