Collects events into sessions, which are series of events that are no further than maxpause apart (defaults to 15m), and then performs an aggregate function across the events that make up the session.
Parameter | Type | Required | Default Value | Description |
---|---|---|---|---|
function [a] | Array of Aggregate Functions | optional[b] | count(as=_count) | Specifies which aggregate functions to perform on each session. |
maxpause | string | optional[b] | 15m | Defines the maximum pause between sessions, for example, events more than this far apart will become separate sessions. |
[b] Optional parameters use their default value unless explicitly set. |
Hide omitted argument names for this function
Omitted Argument NamesThe argument name for
function
can be omitted; the following forms of this function are equivalent:logscalesession("count(as=_count)")
and:
logscalesession(function="count(as=_count)")
These examples show basic structure only.
session()
Examples
Count unique visitors (each visitor defined as non-active for 15 minutes)
logscale
groupby(client_ip, function=session(maxpause=15m))
| count()
Find the visits with most clicks
logscale
groupby(cookie_id, function=session(maxpause=15m, count(as=clicks)))
| sort(clicks)
Find the minimum and maximum values of the field bet within each session
logscale
groupby(cookie_id, function=session([max(bet),min(bet)]))