Create Two Temporary Events for Troubleshooting - Example 1

Create two temporary events for testing or troubleshooting using the createEvents() function

Query

logscale
createEvents(["animal=dog weight=7.0", "animal=cat weight=4.2"])

Introduction

The createEvents() function generates temporary events as part of the query. The function is ideal for generating sample data for testing or troubleshooting.

Example incoming data might look like this:

animal=dog weight=7.0
animal=cat weight=4.2

Step-by-Step

  1. Starting with the source repository events.

  2. flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0[\Add Field/] result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;
    logscale
    createEvents(["animal=dog weight=7.0", "animal=cat weight=4.2"])

    Creates two temporary events to be used for testing purposes. An event with dog and an event with cat.

  3. Event Result set.

Summary and Results

The query is used to create temporary events. The createEvents() function can be combined with different parsers to generate more interesting events, for example, with kvParse() or parseJson().

Sample output from the incoming example data:

@rawstring@timestamp@timestamp.nanos
animal=dog weight=7.017333105088720
animal=cat weight=4.217333105088720