Knowledge Base

Monitoring Studio: Extracting Values from a Multiple-Line File

KB1105 - Feb 14, 2013

Type: Best Practice

Description: How to extract a numeric value from a multiple line data record using Monitoring Studio.

Additional Keywords: File Monitoring, Numeric Value Extraction, String Search, Value Extraction

Related Topics


For monitoring purposes, you may want to extract string or numeric values from a multi-line file. Because this action is not possible per se, you will have to first transform your file into a single-line file and then extract the required values.

The features to use in Monitoring Studio are:

  • The Text Pre-Processing feature
  • The Numeric Value Extraction feature.


In the example below, we will transform the following multi-line file into a single-line file:

<rate name="inj_recips"
last_15_min="16601" />

and extract the value for last_5_min.

Step 1: Transforming Data into a Single-Line Record

  1. In the PATROL Console, right-click the File instance and select KM Commands > New > Text Preprocessing...
  2. Select Convert multi-line records into single lines.
  3. Click Next to continue.
  4. Configure the Text Pre-Processing feature:
    1. In the field This RegExp marks the beginning of the new record, enter <rate name=”inj_recips”
    2. Check the option Include the first line in the result
    3. In the field This RegExp marks the end of a record, enter />
    4. Set ‘;’ as a line separator
  5. Click Next to continue.
  6. Provide an Object display name and click Finish.
  7. The TransformResult file is then created in the tree view:
    and contains one single-line:

Step 2: Extracting a Numeric Value

In the procedure below, we will extract the numeric value of the “last_5_min” parameter.

  1. In the PATROL Console, right-click the Text Pre-Processing instance and select New > Numeric Value Extraction
  2. Click Next to continue.
  3. From the Extract numeric values from drop-down list, select Lines matching the regular expression below.
  4. Enter the first RegEx marking the beginning of the record. In our example, <rate name=”inj_recips”.
  5. Click Next to continue.
  6. From the drop-down list, select after the string, type last_5min=”.
  7. Click Next to continue.
  8. From the drop-down list, select the computation option keep the last value found.
  9. Click Next to continue.
  10. Check the Value option as the parameter to collect.
  11. Click Next to continue.
  12. Provide an Object display name and click Finish.
  13. The Value parameter is then created under the inj_recips_last_5_min  instance: