Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
mbarone
16 - Nebula
16 - Nebula

Use Case

 

You’ve been notified by an email event or by a user that a scheduled module has failed. You’d like to have a quick and relatively painless way to get the output log for that module and see if you can isolate the failure point(s).

 

Problem

 

Let’s say the module that failed is module_abc.yxmd. You go to where the Alteryx engine logs are stored on the server (refer to Alteryx Documentation), and all you see are a bunch of files named Alteryx_Log_[number].log. You have no idea which log contains the information for module_abc.yxmd. You’d literally have to open each one and look at the first line to see which log is for the failed module:

 

mbarone_0-1674569276448.png

 

If only there were an easy way to have Alteryx read through them all and pull out just the log associated with module_abc.yxmd.

 

Solution

 

Since you know where the log files are stored, we could use a Directory tool to collect all their paths:

 

mbarone_1-1674569276452.png

 

And then we could filter for the date that it failed using a Filter tool (note that I’m allowing for a date range in case I ever want to search for more than one day):

 

mbarone_2-1674569276457.png

 

And then, we can use a Dynamic Input tool to read in just the first line of each file (note the specific configuration of the highlighted options):

 

mbarone_3-1674569276460.png

 

mbarone_4-1674569276478.png

 

And from there, you could simply filter for the module you’re interested in.

 

If only it were that simple...

 

The problem here is that if Alteryx is currently running any module, the log will be open and therefore cause the Dynamic Input tool to produce an error. If only there were a way to filter the logs for only the ones that are not open...

 

Well, not only did my fellow ACE Claire (@clmc9601) address this very issue in a prior Engine Works Blog, but she also wrote a macro that uses Python to filter for only unopened logs. Read all about it here!

 

So, I made use of her awesome macro and put it together with the steps I mentioned earlier, added a few more pieces, and came up with the Log Extraction App.


The app has the following user-entered parameters:

 

mbarone_5-1674569276494.png

 

Here is an example where I’m looking for the log for the module C:\Users\mbarone\OneDrive - Paychex\Desktop\Ayx_Ace\Blog\Random_Grouping\Random_Grouping.yxmd. My engine logs are stored in C:\AlteryxLogs, and it was run on 2023-01-23. I want the logs for this module on that date to be written to C:\Users\mbarone\OneDrive - Paychex\Desktop\Ayx_Ace\Blog\Random_Grouping.

 

Here’s my app configuration:

 

mbarone_6-1674569276518.png

 

I click Finish, and then go to the folder I requested the log to be output to, and see the log:

 

mbarone_7-1674569276524.png

 

And then, I can open the log and look at the details of the run, including any errors:

 

mbarone_8-1674569276539.png

 

Let’s look at the “guts” of the app:

 

mbarone_9-1674569276591.png

 

Feel free to download the Log Extraction App from the Gallery and use it as necessary. Have a look at each tool’s configuration so you can see the logic being used. Nothing too crazy going on – fairly basic-to-intermediate-level stuff.

 

Special thanks again to Claire @clmc9601 for the collaboration on this one!

 

Enjoy!

Comments