table of contents
| LTTNG-ENABLE-CHANN(1) | LTTng Manual | LTTNG-ENABLE-CHANN(1) |
NAME¶
lttng-enable-channel - Create or enable LTTng channels
SYNOPSIS¶
Create a Linux kernel channel:
lttng [GENERAL OPTIONS] enable-channel --kernel
[--discard | --overwrite] [--output=(mmap | splice)]
[--subbuf-size=SIZE] [--num-subbuf=COUNT]
[--switch-timer=PERIODUS] [--read-timer=PERIODUS]
[--monitor-timer=PERIODUS]
[--buffer-ownership=system] [--buffer-allocation=per-cpu]
[--tracefile-size=SIZE [--tracefile-count=COUNT]]
[--session=SESSION] CHANNEL
Create a user space channel:
lttng [GENERAL OPTIONS] enable-channel --userspace
[--overwrite |
[--discard] [--blocking-timeout=TIMEOUTUS]
[--auto-reclaim-memory=(off | consumed | older-than:AGEUS)]]
[--output=mmap] [--buffer-ownership=(user | process)]
[--buffer-allocation=(per-cpu | per-channel)]
[--buffer-preallocation=(preallocate | on-demand)]
[--subbuf-size=SIZE] [--num-subbuf=COUNT]
[--switch-timer=PERIODUS] [--read-timer=PERIODUS]
[--monitor-timer=PERIODUS] [--watchdog-timer=PERIODUS]
[--tracefile-size=SIZE [--tracefile-count=COUNT]]
[--session=SESSION] CHANNEL
Enable channel(s):
lttng [GENERAL OPTIONS] enable-channel (--userspace | --kernel)
[--session=SESSION] CHANNEL[,CHANNEL]...
DESCRIPTION¶
The lttng enable-channel command does one of:
See lttng-concepts(7) to learn more about channels.
The channel(s) to create or enable belong to:
With the --session=SESSION option
Without the --session option
Note
The lttng-enable-event(1) command can automatically create a default channel when no channel exists for the provided tracing domain.
See the “EXAMPLES” section below for usage examples.
List the channels of a given recording session with the lttng-list(1) and lttng-status(1) commands.
Disable an enabled channel with the lttng-disable-channel(1) command.
Important
As of LTTng 2.15.0, you may NOT perform the following operations with the enable-channel command:
OPTIONS¶
See lttng(1) for GENERAL OPTIONS.
Tracing domain¶
One of:
-k, --kernel
-u, --userspace
Recording target¶
-s SESSION, --session=SESSION
Buffer ownership model¶
One of:
--buffers-global
Deprecated.
--buffer-ownership=MODEL
process
If you connect to the root session daemon
See the “Session daemon connection” section of lttng(1) to learn how a user application connects to a session daemon.
Otherwise
Only available with the --userspace option.
system
Only available with the --kernel option.
As of LTTng 2.15.0, this is the default buffer ownership model for the Linux kernel tracing domain, but this may change in the future.
user
If you connect to the root session daemon
See the “Session daemon connection” section of lttng(1) to learn how a user application connects to a session daemon.
Otherwise
Only available with the --userspace option.
As of LTTng 2.15.0, this is the default buffer ownership model for the user space tracing domain, but this may change in the future.
--buffers-pid
Deprecated.
--buffers-uid
Deprecated.
Buffer allocation policy¶
--buffer-allocation=POLICY
per-channel
Setting --buffer-ownership to user or process determines what entity gets a channel-wise ring buffer.
Only available with the --userspace option.
per-cpu
Setting --buffer-ownership to user, process, or system determines what entity gets a set of per-CPU ring buffers.
Using this buffer allocation policy implies adding the cpu_id context field, without any way to remove it, for the created channel, similar to running:
$ lttng add-context --session=SESSION --channel=CHANNEL \
--type=cpu_id
As of LTTng 2.15.0, this is the default buffer allocation policy, but this may change in the future.
Buffer preallocation policy¶
--buffer-preallocation=POLICY
preallocate
This policy provides consistent performance but uses more memory upfront. Use this policy to optimize instrumented application startup time.
As of LTTng 2.15.0, this is the default buffer preallocation policy, but this may change in the future.
on-demand
This policy uses less initial memory but may introduce slight performance overhead when allocating new memory during tracing.
Only available with the --userspace option.
Automatic memory reclaim¶
--auto-reclaim-memory=STRATEGY
STRATEGY is one of:
off (default)
consumed
This strategy is not available for channels of recording sessions in snapshot mode or without an output.
older-than:AGEUS
The ms (milliseconds), s (seconds), m (minutes), and h (hours) suffixes are supported.
This is more or less equivalent to automatically running the lttng-reclaim-memory(1) command. LTTng automatically evaluates the eligibility of sub-buffers for a memory reclaim operation at regular intervals (every half AGEUS µs, but also at least a period defined at build time) and reclaims sub-buffers of which the age of the closing time have exceeded AGEUS µs.
More specifically:
If AGEUS > last stream activity age
If AGEUS < last stream activity age
Only available with the --userspace and --discard options.
Event record loss mode¶
--blocking-timeout=TIMEOUTUS
TIMEOUTUS is one of:
0 (default)
inf
N, a positive value
This option is only available with both the --userspace and --discard options.
One of:
--discard
As of LTTng 2.15.0, this is the default event record loss mode, but this may change in the future.
--overwrite
Sub-buffers¶
--num-subbuf=COUNT
The effective value is COUNT rounded up to the next power of two.
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
metadata channel
--output=TYPE
TYPE is one of:
mmap
splice
Only available with the --kernel option.
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
metadata channel
--subbuf-size=SIZE
The effective value is SIZE rounded up to the next power of two.
The k (KiB), M (MiB), and G (GiB) suffixes are supported.
The minimum sub-buffer size, for each tracer, is the maximum value between the default below and the system page size (see getconf(1) with the PAGE_SIZE variable).
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
metadata channel
Trace files¶
--tracefile-count=COUNT
COUNT set to 0 means “unlimited”.
Default: 0.
You must also use the --tracefile-size option with this option.
--tracefile-size=SIZE
SIZE set to 0 means “unlimited”.
Default: 0.
Note
Timers¶
--monitor-timer=PERIODUS
Set PERIODUS to 0 to disable the monitor timer.
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
--read-timer=PERIODUS
Set PERIODUS to 0 to disable the read timer.
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
metadata channel
--switch-timer=PERIODUS
Set PERIODUS to 0 to disable the switch timer.
Default values:
--userspace and --buffer-ownership=user options
--userspace and --buffer-ownership=process options
--kernel and --buffer-ownership=system options
metadata channel
--watchdog-timer=PERIODUS
Set PERIODUS to 0 to disable the watchdog timer.
You may only use this option with the --userspace and --buffer-ownership=user options.
Default value: 2000000.
Program information¶
-h, --help
This option attempts to launch /usr/bin/man to view this manual page. Override the manual pager path with the LTTNG_MAN_BIN_PATH environment variable.
--list-options
EXIT STATUS¶
0
1
2
3
4
ENVIRONMENT¶
LTTNG_ABORT_ON_ERROR
LTTNG_HOME
Defaults to $HOME.
Useful when the Unix user running the commands has a non-writable home directory.
LTTNG_LIST_LEGACY
Note that the legacy output doesn’t show anything related to features introduced after LTTng 2.14.
LTTNG_MAN_BIN_PATH
LTTNG_NO_UTF_8
LTTNG_SESSION_CONFIG_XSD_PATH
LTTNG_SESSIOND_PATH
The --sessiond-path general option overrides this environment variable.
LTTNG_TERM_COLOR
The NO_COLOR environment variable overrides this.
One of:
auto (default)
always
never
NO_COLOR
See NO_COLOR <https://no-color.org/> to learn more.
FILES¶
$LTTNG_HOME/.lttngrc
This is where LTTng stores the name of the Unix user’s current recording session between executions of lttng(1). lttng-create(1) and lttng-set-session(1) set the current recording session.
$LTTNG_HOME/lttng-traces
Override this path with the --output option of the lttng-create(1) command.
$LTTNG_HOME/.lttng
$LTTNG_HOME/.lttng/sessions
/etc/lttng/sessions
Note
$LTTNG_HOME defaults to the value of the HOME environment variable.
EXAMPLES¶
Example 1. Create a Linux kernel channel with default attributes in the current recording session.
The following command line only creates a new channel if my-channel doesn’t name an existing Linux kernel channel in the current recording session.
$ lttng enable-channel --kernel my-channel
Example 2. Create a user space channel with a per-process buffer ownership model in a specific recording session.
See the --session and --buffer-ownership options.
$ lttng enable-channel --session=my-session --userspace \
--buffer-ownership=process my-channel
Example 3. Create a user space channel with a per-user buffer ownership model (default) and a per-channel buffer allocation policy.
See the --buffer-allocation option.
$ lttng enable-channel --userspace \
--buffer-allocation=per-channel my-channel
Example 4. Create a user space channel with an “on-demand” preallocation policy and an automatic memory reclaim.
See the --buffer-preallocation and --auto-reclaim-memory options.
$ lttng enable-channel --userspace my-channel \
--buffer-preallocation=on-demand \
--auto-reclaim-memory=older-than:30s
Example 5. Create a Linux kernel channel in the current recording session with four 32-MiB sub-buffers per ring buffer.
See the --num-subbuf and --subbuf-size options.
$ lttng enable-channel --kernel my-channel \
--num-subbuf=4 --subbuf-size=32M
Example 6. Create a user space channel in the current recording session with trace file rotation.
See the --tracefile-count and --tracefile-size options.
$ lttng enable-channel --userspace my-channel \
--tracefile-count=16 --tracefile-size=8M
Example 7. Enable two user space channels of a specific recording session.
$ lttng enable-channel --session=my-session --userspace \
canal-d,rds
RESOURCES¶
COPYRIGHT¶
This program is part of the LTTng-tools project.
LTTng-tools is distributed under the GNU General Public License version 2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html>. See the LICENSE <https://github.com/lttng/lttng-tools/blob/master/LICENSE> file for details.
THANKS¶
Special thanks to Michel Dagenais and the DORSAL laboratory <http://www.dorsal.polymtl.ca/> at École Polytechnique de Montréal for the LTTng journey.
Also thanks to the Ericsson teams working on tracing which helped us greatly with detailed bug reports and unusual test cases.
SEE ALSO¶
lttng(1), lttng-disable-channel(1), lttng-list(1), lttng-concepts(7)
| 18 December 2025 | LTTng 2.15.0 |