pcap command converts Retis events into pcap-ng format files that can be opened with tools like Wireshark or tcpdump.
Usage
Overview
The pcap command generates pcap-ng files from stored Retis events, optionally filtering by probe name. Each event’s packet data is extracted and written to the pcap file along with metadata embedded in custom blocks.Arguments
Input file containing events to convert.Can be a single file or a range of rotated files.
Options
Write the generated pcap output to a file.If not specified, output is written to stdout.
Filter events from a specific probe.Probes follow the
[TYPE:]TARGET pattern (same as retis collect).List all probes available in the input file.Shows which probes have events with packet data that can be converted to pcap.
Examples
Pcap-ng Format
The generated files use the pcap-ng format with the following features:Interface Description Blocks
Fake interfaces are created for each probe point in the format{type}/{name}:
Enhanced Packet Blocks
Each packet includes:- Packet data (Ethernet frame)
- Timestamp from the event
- Comment with full event details
- Custom UTF-8 option with complete event JSON
Schema Block
A custom block containing the JSON schema for Retis events is embedded at the start of the file.List Probes Output
Example output from--list-probes:
Wireshark Integration
The generated pcap files can be opened directly in Wireshark:- Events appear as normal packets
- Full Retis event data is in packet comments
- Interface names show the probe points
- JSON event data is in custom options
Tcpdump Usage
Read pcap files with tcpdump:Requirements
For successful pcap generation:- Events must have a packet section (raw packet data)
- Events must have a kernel section (probe information)
- Events must have a common section (timestamp, etc.)
Statistics
At the end of processing, statistics are displayed:Common Use Cases
Analyze with Wireshark
Filter specific probe point
Quick packet inspection
Export for external analysis
Limitations
- Only events with packet data can be converted
- Packet data must be complete (not truncated)
- Requires kernel and common event sections
- L2 header must be present in packet data
Error Messages
Probe not found in the events
Probe not found in the events
The specified probe with
--probe doesn’t exist in the input file.Use --list-probes to see available probes.Could not find any compatible probe
Could not find any compatible probe
No events in the file have the required packet data.Ensure you collected with a collector that captures packet data (e.g.,
skb).