### window.last

Supported in:

    window.last(values_to_sort_by, values_to_return)

#### Description

This aggregation function returns a string value derived from an event with the highest correlated int value in the match window. An example use case is getting the userid from the event with the lowest timestamp in the match window (highest timestamp).

#### Param data types

`INT`, `STRING`

#### Return type

`STRING`

#### Code samples

Get a string value derived from an event with the highest correlated int value in the match window.

    rule test_windows_last {

    // This rule sets the outcome $last_event to the highest correlated int value
    // in the 5 minute match window.

      meta:

      events:
        $e.principal.user.userid = $userid

      match:
        $userid over 5m

      outcome:
        $last_event = window.last($e.metadata.event_timestamp.seconds, 
        $e.metadata.vendor_name)
        // yields v3 if the events in the match window are 1, 2 and 3 and 
        // corresponding values v1, v2, and v3.

      condition:
        $e
    }