Call Named Function on a Field - Example 2
Calls the named function (count()
) on a field over a set of events
Query
timeChart(function=[callFunction(?{function=count}, field=value)])
Introduction
The callFunction()
function calls a specific
function. The parameters of the called funcion are passed as parameters
in callFunction()
.
In this example, the callFunction()
function is
used to call the named function (count()
) on a
field over a set of events using the query parameter
?function
.
Step-by-Step
Starting with the source repository events.
- flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0{{Aggregate}} result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;logscale
timeChart(function=[callFunction(?{function=count}, field=value)])
Counts the events in the value field, and displays the results in a timechart.
Notice how the query parameter
?function
is used to select the aggregation function for atimeChart()
. Event Result set.
Summary and Results
The query is used to count events and chart them over time. Because we
are using callFunction()
, it could be a different
function based on the dashboard parameter.
Using a query parameter (for example,
?function
) to select the aggregation
function for a timeChart()
is useful for dashboard
widgets.
Using callFunction()
allow for using a function
based on the data or dashboard parameter instead of writing the query
directly.