Skip to content

slice

Keeps a range of events within the interval [begin, end) stepping by stride.

slice [begin=int, end=int, stride=int]

The slice operator selects a range of events from the input. The semantics of the operator match Python’s array slicing.

The beginning (inclusive) of the range to keep. Use a negative number to count from the end.

The end (exclusive) of the range to keep. Use a negative number to count from the end.

The number of elements to advance before the next element. Use a negative number to count from the end, effectively reversing the stream.

slice begin=100, end=200
slice begin=-5
slice end=-10

Return the last 50 events, except for the last 2

Section titled “Return the last 50 events, except for the last 2”
slice begin=-50, end=-2
slice begin=1, end=-1

Return every second event starting from the tenth

Section titled “Return every second event starting from the tenth”
slice begin=9, stride=2

Return all but the last five events in reverse order

Section titled “Return all but the last five events in reverse order”
slice end=-5, stride=-1

head, tail