// SPDX-FileCopyrightText: 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
// SPDX-FileCopyrightText: 2020-2026 Philippe Proulx <pproulx@efficios.com>
//
// SPDX-License-Identifier: CC-BY-SA-4.0

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

NAME
----
lttng-clear - Clear an LTTng recording session


SYNOPSIS
--------
[verse]
*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *clear* ['SESSION' | option:--all]


DESCRIPTION
-----------
The `lttng clear` command clears one or more recording sessions, that
is, it:

* Deletes the contents of their recording buffers (event record
  channels) and of all their local and streamed trace data.

* Resets to{nbsp}0 all counters of all their map channels (see
  man:lttng-add-map-channel(1)), and resets to false every counter
  overflow flag (see man:lttng-show-maps(1)).
+
The `clear` command does :not: remove counters from maps: it only resets
their values.

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

The `clear` command clears:

Without any option::
    The current recording session.
+
See man:lttng-concepts(7) to learn more about the current recording
session.

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

With the 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.

If a recording session is configured in snapshot mode (see the
nloption:--snapshot option of the man:lttng-create(1) command), the
`clear` command only clears the recording buffers and resets the map
channel counters.

For a given recording session, if at least one rotation occurred (see
man:lttng-concepts(7)), the `clear` command only clears its recording
buffers and its current trace chunk, :not: its archived trace chunks.

NOTE: The nloption:--disallow-clear option and the
`LTTNG_RELAYD_DISALLOW_CLEAR` environment variable of
man:lttng-relayd(8) can disable remote clearing operations. If LTTng
sends recording data over the network for the selected recording
session(s) to an LTTng relay daemon configured as such, the `clear`
command fails.

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


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


Recording target
~~~~~~~~~~~~~~~~
option:-a, option:--all::
    Clear all the recording sessions 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'.


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


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


[[examples]]
EXAMPLES
--------
.Clear the current recording session.
====
[role="term"]
----
$ lttng clear
----
====

.Clear a specific recording session.
====
[role="term"]
----
$ lttng clear my-session
----
====

.Clear all recording sessions.
====
See the option:--all option.

[role="term"]
----
$ lttng clear --all
----
====


include::common-footer.txt[]


SEE ALSO
--------
man:lttng(1),
man:lttng-add-map-channel(1),
man:lttng-create(1),
man:lttng-concepts(7),
man:lttng-relayd(8)
