Introducing audit logs from the rule solver

Solving rules is one thing. But imagine that you could access the history of the rule solver and monitor its activity with BI tools. Well, as of now, you can.

Jakub Kaninsky
Desarrollador Líder
?
Nuevas funciones
Check icon A checkmark inside a circle signifying "yes" Minus icon A minus inside a circle signifying "no" PROS Icon A plus symbol representing positive aspects or benefits. CONS Icon A minus symbol representing negative aspects or drawbacks.

Let us consider an implementation of a simple pricing business rule. We have a set of parameters (product id, subscription period, promo code, …) that determine the final price of a given product. Within DecisionRules, such a rule is typically implemented in the form of a Decision Table, which can be easily built, tested and deployed. Once we have taken these steps, we can use the rule in production simply by calling our Decision Table via the Rule Solver API. The moment our customer orders a particular product, the responsible server makes a call to DecisionRules and lets the Rule Solver determine the price based on the input data. The price is returned and the order process continues as expected.

This is all nice, but is it enough? In practice, the decision process can be a lot more complex, and the Decision Table can have hundreds or thousands of rows. Such complex rules may easily have errors in them which will be hard to spot at first glance. Therefore, it would be desirable to oversee the activity of the rule solver and react to the occurrence of any unexpected behavior. Even if we have tested the rule very carefully and know for sure that it is doing exactly what we need, keeping track of the rule solver activity has many benefits. After all, we are talking about business data which can be highly valuable. When we have access to it, we may perform analyses of our customers’ behavior and effectively optimize the employed business rules as well as the products themselves.

Of course, the data sent to and obtained from the DecisionRules rule solver can be stored on the side of the server managing the ordering process. However, this means additional logic as well as additional computing and storage resources. Also, such a solution could not provide any intrinsic data of the rule solver, like for instance debug logs or other useful information.

Following the above given argument as well as numerous conversations with our customers, we decided to provide the audit logging functionality, and we are happy to announce that it has been made available in our public cloud!

Generate audit logs

As everything with DecisionRules, taking advantage of the audit logging feature is super easy. All you have to do is go to rule settings of the rule whose audit logs you wish to observe and turn on the Audit Logs slider.

As soon as the audit logging is turned on, the rule solver will generate an audit log every time it is called. The logs may look as follows.

As you see, there is a lot of information. For now, let me just draw your attention to the inputData and outputData properties of the audit object which point to the input and output data from the rule solver, respectively. These will typically be the audit log data of our greatest interest.

Get audit logs

Audit logs can be obtained from DecisionRules by sending an http request via our brand new Business Intelligence API which has been introduced exactly for this purpose. To be able to use it, you need to generate a Business Intelligence API Key. Just go to the API Keys section in the app menu and scroll down to the appropriate section. Click the Add Business Intelligence API Key button and you are good to go. The generated key has to be sent together with the request, either in the header or as a query parameter.

To obtain exactly what you are looking for, we have prepared a number of filters. You can of course search for audit logs by rule ids and versions. Moreover, it is also possible to filter by solver keys, tags, or dates. All details are well described in our Documentation.

What next?

You can use the audit logging functionality in any way you like. It is in particular a great tool for monitoring rules in production, discovering and fixing production errors or performing business oriented analyses. This way, you can really make the most of your decision making processes!

Yet this is still not all the great news. To make the lives of our customers even easier, we have committed to prepare detailed instructions for connecting the audit Business Intelligence API to the most common BI tools, starting with Power BI. More about this in an upcoming article. Stay tuned!

Thanks for reading

Enjoyed the read? Let’s take the next step together.