Searching logs
We have previously looked at how to set up custom logging for your workflow.
In this article we will show you how you can search through the logs that have been generated by a block, to find information on what was transferred, and when it happened.
Canvas logs block output responses and stores the data for 30 days.
The three search types​
Canvas provides different ways of searching through the logged data. The following screenshots will illustrate the differences between the three search types:
1) Search option “All data”:​
“All data” simply returns all data output from a block in a given time range: All logged data output from the block “Update Employees” in the given time range will be returned.
2) Search option “By response”:​
“By response” is only available if you have defined a search model for a block, which lets you search for specific values in specific fields (for example search for specific employee numbers, order numbers, etc.)
Logged output for the block “Update Employees” will be searched to see if a match can be found in any of the fields from the search model.
(Note, this will only work starting from the time the search model was set up.)
3) Search option “By user log”:​
“By user log” lets you type in a text string to search through all messages generated using logger.log() in the block code. (Note that search string should not be placed within quotation marks, i.e. just Test, not “Test”).
All messages logged by logger.log() in the block “Handle errors” will be searched to see if they start with “Validation error, badgeNo 12345”.
(Note that the search string is entered without quotation marks “ around it.)
Creating a search​
To search through logged items for a given workflow, go to the workflow editor and click the search icon🔍: Click the search icon in the workflow editor.
A popup will appear, showing a list of previous searches and their results:
The search list shows previous searches and their results.
(The list may be empty if you have never made any searches before.)
Click the New button to create a new search query.
You will be presented with the following search options:
- Under Block select which block you want to search the logs for
- Under Search option gives you the option of three search types described above (“All data”, “By response”, and “By user log”)
- Search From and Search To specify the search range
- Hide in result lets you choose results to filter out, for example if the block ran but did not provide a response
Click the Find button to execute the search.
Viewing the search results​
When the search has finished it will show status Completed, and it will show how many matches was found:
The result “3/8” means that the search found 3 matches by checking the logs for 8 separate runs.
Click the View button to inspect the results.
Here you will find the logged output for the different runs, and a button for downloading the logs if needed: We can see that in Run #18, the block logged a validation error related to badgeNo 12345.