The following instructions walk through a basic setup for collecting kernel-level LTTng trace data. Note that these events don't come from any one process, they are produced by the kernel itself and can therefore concern any process running on the system. For more help setting up LTTng, including for application-level tracing, see the getting started guide(opens new window) and further documentation.
Run an LTTng relayd instance. More information about relayd can be found here.(opens new window)
lttng-relayd
Create an LTTng tracing session in live mode pointed at the LTTng relayd instance.
sudo lttng create linux --live --set-url net://127.0.0.1
Create and enable LTTng recording event rules. This example enables some generally useful events: failing IO system calls, process fork and exec, netdev state changes, and ext4 errors.
# Failing IO system calls
sudo lttng enable-event --kernel --syscall open,write,read,close --filter '_ret != 0'
# Process fork and exec static tracepoints
sudo lttng enable-event --kernel sched_process_fork,sched_process_exec
# netdev state changes and ext4 error function calls via Linux kprobes
# NOTE: requires kprobes support in the kernel (CONFIG_KPROBES=y)
sudo lttng enable-event --kernel --probe netdev_state_change netdev_state_change
sudo lttng enable-event --kernel --probe __ext4_error+0x0 ext4_error
Start the LTTng recording session.
sudo lttng start
Set the plugin configuration to point to the running relayd instance.
The following describes the default mapping between CTF(opens new window) concepts
and Modality's concepts.
See the configuration section for ways to change the default behavior.
CTF streams are represented as separate Modality timelines
CTF trace and stream properties are represented as Modality timeline attributes under the timeline.internal.ctf prefix
CTF event common, specific, and packet context fields are represented as Modality event attributes under the timeline.internal.ctf prefix
Configuration fields should be placed in a [plugins.ingest.collectors.lttng-live.metadata] table in
a modality-reflector configuration file.
All fields are optional.
run-id
UUID
Use the provided UUID as the run ID instead of generating a random one.
trace-uuid
UUID
Provide a trace UUID for this data import. This UUID will override a UUID contained in the CTF metadata, if any.
This is useful for constructing deterministic trace UUIDs which form the timeline IDs.
log-level
string
Logging level for libbabeltrace itself, useful for diagnosing import issues. Must be one of trace, debug, info, warning, error, fatal, none. Defaults to none. See the libbabeltrace documentation(opens new window) for more info.
retry-duration-us
integer
Set the duration of a retry if a component requires it, in microseconds. Corresponds to the retry-duration(opens new window) parameter in babeltrace.
session_not_found_action
string
What to do when the message iterator does not find the remote tracing session. Must be one of [continue, fail, end]. Corresponds to the session-not-found-action(opens new window) parameter in babeltrace.
url
string
URL to connect to the LTTng relay daemon. Corresponds to the inputs(opens new window) parameter in babeltrace.
# config.toml for modality-reflector[plugins.ingest.collectors.lttng-live.metadata]log-level='info'retry-duration_us=10url='net://127.0.0.1/host/example-host/example-session'