This simple sample introduce the use of Kettle's Regex step to process a Tomcat's log file. We will parse the log and separated the row based on a regular expression pattern.
You can download the file samples at the end of the article.
- We get the log file's content through a Text Input Step (Tomcat Logs).
- Validate the pattern using Regex Evalution step, only get rows with date information plus message in the same row. Save the boolean result in a field (result).
- Filtering the rows from previous step based on result field using Filter Rows step.
- You can see the results by previewing Others and Tanggal dummy steps.
- Split the matching content into 3 fields (tanggal, jam and pesan) by using Modified Java Script Value step (Hasil Akhir).
By using Modified Java Script Value
, we have the risk of processing bottleneck in this step as scripting can be slower than if we implemented it in plugin form.
Nevertheless, this sample show the flexibility of Kettle if you know how to manipulate any data type using Java language.