// SPDX-FileCopyrightText: 2015-2026 Philippe Proulx <pproulx@efficios.com>
//
// SPDX-License-Identifier: CC-BY-SA-4.0

lttng-save(1)
=============
:revdate: 27 April 2026


NAME
----
lttng-save - Save LTTng recording session configurations


SYNOPSIS
--------
[verse]
*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *save* [option:--force] [option:--output-path='DIR']
      [option:--no-triggers] [option:--all | 'SESSION']


DESCRIPTION
-----------
The `lttng save` command saves to files the configurations of:

With the 'SESSION' argument::
	The recording session named 'SESSION'.

Without the 'SESSION' argument::
    Implicit option:--all option: *all* the recording sessions of the
    connected session daemon for your Unix user, or for all users if
    your Unix user is `root`, as listed in the output of `lttng list`
    (see man:lttng-list(1)).
+
See the ``Session daemon connection'' section of man:lttng(1) to learn
how a user application connects to a session daemon.

See man:lttng-concepts(7) to learn more about recording sessions.

Use the `save` command in conjunction with the man:lttng-load(1) command
to save and restore the complete configurations of recording sessions.

The `save` command does :not: save tracing data, only the recording
session parameters, including the event record channel and recording
event rule configurations.

Each saved recording session configuration file also contains *all* the
triggers (see man:lttng-add-trigger(1)) of the connected session daemon
for your Unix user, or for all users if your Unix user is `root`, even
those triggers which aren't directly related to the targeted recording
session(s). This is needed because, for example, an ``increment map
value'' trigger action targets a map channel of a specific recording
session, but the trigger itself is a session daemon-wide object.

The man:lttng-load(1) command makes the loading Unix user the owner of
every loaded recording session and trigger, regardless of their original
owner.

Avoid saving any trigger with the option:--no-triggers option. Note,
however, that without saved triggers, the man:lttng-load(1) command
won't restore, amongst other things, the ``increment map value'' actions
for the loaded recording session(s).

The default output directory path is `$LTTNG_HOME/.lttng/sessions`
(`$LTTNG_HOME` defaults to `$HOME`). Override the default output
directory path with the option:--output-path option. Each recording
session configuration file is named __SNAME__++.lttng++,
where{nbsp}__SNAME__ is the original recording session name.

By default, the `save` command does :not: overwrite existing recording
session configuration files: the command fails. Allow the `save` command
to overwrite existing recording session configuration files with the
option:--force option.

See the ``<<examples,EXAMPLES>>'' section below for usage examples.


include::common-lttng-cmd-options-head.txt[]


option:-a, option:--all::
    Save all the recording session configurations of your Unix user, or
    of all users if your Unix user is `root`, as listed in the output of
    man:lttng-list(1), instead of the current recording session or the
    recording session named 'SESSION'.

option:-f, option:--force::
    Overwrite existing recording session configuration files when
    saving.

option:--no-triggers::
    Do :not: save any trigger (see man:lttng-add-trigger(1)).
+
This is the behaviour of LTTng{nbsp}≤{nbsp}2.15.
+
Without this option, each saved recording session configuration file
also contains all the triggers of the connected session daemon for your
Unix user, or for all users if your Unix user is `root`, even those
triggers which aren't directly related to the targeted recording
session(s).
+
With this option, the man:lttng-load(1) command won't restore,
amongst other things, the ``increment map value'' actions of the loaded
recording session(s).

option:-o 'DIR', option:--output-path='DIR'::
    Save recording session configuration files to the directory 'DIR'
    instead of `$LTTNG_HOME/.lttng/sessions` (`$LTTNG_HOME` defaults to
    `$HOME`).


include::common-lttng-cmd-help-options.txt[]


include::common-lttng-cmd-after-options.txt[]


[[examples]]
EXAMPLES
--------
.Save all the recording session configurations to the default output directory.
====
[role="term"]
----
$ lttng save
----
====

.Save a specific recording session configuration to a specific output directory.
====
See the option:--output-path option.

[role="term"]
----
$ lttng save my-session --output-path=/path/to/sessions
----
====

.Allow LTTng to overwrite existing recording session configuration files when saving.
====
See the option:--force option.

[role="term"]
----
$ lttng save --force
----
====

.Save the configuration of a specific recording session without saving any trigger.
====
See the option:--no-triggers option.

[role="term"]
----
$ lttng save my-session --no-triggers
----
====


include::common-footer.txt[]


SEE ALSO
--------
man:lttng(1),
man:lttng-add-trigger(1),
man:lttng-load(1),
man:lttng-concepts(7)
