This is a translation of the original English documentation page. Help us make it better.

1 Esempi di utilizzo

Panoramica

Questa sezione presenta esempi di utilizzo dei passaggi di pre-elaborazione per svolgere alcuni compiti pratici.

Filtering VMware event log records

Using a regular expression preprocessing to filter unnecessary events of the VMWare event log.

1. On a working VMWare Hypervisor host check that the event log item vmware.eventlog[<url>,<mode>] is present and working properly. Note that the event log item could already be present on the hypervisor if the Template VM VMWare template has been linked during the host creation.

2. On the VMWare Hypervisor host create a dependent item of 'Log' type and set the event log item as its master.

In the "Preprocessing" tab of the dependent item select the "Matches regular expression" validation option and fill pattern, for example:

".* logged in .*" - filters all logging events in the event log
       "\bUser\s+\K\S+" -  filter only lines with usernames from the event log

If the regular expression is not matched then the dependent item becomes unsupported with a corresponding error message. To avoid this mark the "Custom on fail" checkbox and select to discard unmatched value, for example.

Another approach that allows using matching groups and output control is to select "Regular expression" option in the "Preprocessing" tab and fill parameters, for example:

pattern: ".*logged in.*", output: "\0" - filters all logging events in the event log
       pattern "User (.*?)(?=\ )", output: "\1" - filter only usernames from the event log

Checking retrieved value type

This example uses the Custom multiplier preprocessing step to check if the retrieved item value type is numeric.

In the Preprocessing tab of an item, select the "Custom multiplier" preprocessing step and set the following parameter:

# Multiplies the retrieved value by 1:
       number: 1

If preprocessing fails (e.g., input is not numeric), then the item becomes unsupported with a corresponding error message. To avoid this, mark the "Custom on fail" checkbox and select an option such as discarding the value or setting a custom one.