sort command rearranges events so they are grouped by tracking ID, allowing you to follow individual packets through the networking stack.
Usage
Overview
Retis can track packets across the networking stack, generating multiple events for the same packet (e.g., in IP stack, TCP stack, OvS, netfilter). The sort command uses tracking information to identify unique packets and group related events together. An “event series” is a collection of events that share the same tracking ID (belong to the same packet).Arguments
Input file containing events to sort.Can be:
- A single file path
- A range of rotated files (e.g.,
events.data[0-5])
Options
Maximum number of events to buffer while sorting.Sorting requires buffering events while waiting for other events from the same series. If many events are interleaved, you may need to increase the buffer size.A value of zero means the buffer can grow endlessly.
Write sorted event series to a file.The output file will contain series in JSON format and cannot be the same as the input file.
Write events to stdout even if
--out is used.Format used when printing events.Options:
multi-line- Detailed output (default)single-line- Compact output
Print timestamps as UTC instead of monotonic timestamps.
Print link-layer information from packets.
Examples
Output Example
Sorted output shows event series with indentation indicating related events:↳ symbol indicates events that belong to the same packet series.
How Tracking Works
Retis tracks packets using multiple methods:- Core tracking - Generates unique identifiers by tracking socket buffer data
- skb-tracking collector - Reports tracking information in events (must be enabled during collection)
- OVS collector - Tracks packets through OpenVSwitch upcalls
The
skb-tracking collector must be enabled during collection for sort to work properly.Buffer Size Considerations
The--max-buffer option controls how many events are held in memory:
- Too small: Events from the same packet may be split across multiple series
- Too large: Higher memory usage
- Zero: Unlimited buffer, highest accuracy but unbounded memory
Paging
Output is automatically piped through a pager when longer than the terminal:Common Use Cases
Track packet through stack
Analyze packet drops
Export sorted series
Limitations
- Input file must contain unsorted events (not already sorted)
- Cannot sort in-place (output file must differ from input)
- Requires
skb-trackingcollector to be enabled during collection - Old event format files cannot be saved with
--out
