DSL for generating reports from logfiles
In this recipe, we will give another DSL example for constructing a simple configuration language for the analysis of logfiles, and the generation of reports based on the content of such logfiles. The technique used in this recipe is similar to the one used in the recipe DSL for executing commands over SSH.
Getting ready
Let's consider having the following performance log data:
execution of getCustomerName took 244ms execution of getCustomerName took 144ms execution of getAccountNumber took 44ms execution of getCustomerName took 244ms execution of getCustomerName took 24ms execution of getAccountNumber took 112ms execution of getCustomerName took 200ms execution of getCustomerName took 22ms ...
The goal is to calculate the average and total times spent on each method. Of course, we could have written a very simple script to reach the same result, but our purpose is to create a DSL that will allow parsing any arbitrary logfile format and extract both...