Replace Word or Substring With Another

Replace a word or substring with another in an event set using the replace() function with a regular expression

Query

flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0>Augment Data] result{{Result Set}} repo --> 0 0 --> result
logscale
replace(regex=propperties, with=properties)

Introduction

The replace() function can be used to replace each substring of the specified fields value that matches a given regular expression with the given replacement.

In this example, the replace() function is used to correct a spelling mistake.

Step-by-Step

  1. Starting with the source repository events.

  2. flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0>Augment Data] result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;
    logscale
    replace(regex=propperties, with=properties)

    Replaces the word propperties with the word properties.

  3. Event Result set.

Summary and Results

The query is used to correct spelling mistakes in an event set. Changing words or other substrings like this with a regular expression is useful in many situations, where it is necessary to make quick changes of field values.