lttng-add-trigger(1): clarify the `--rate-policy` documentation
[lttng-tools.git] / doc / man / lttng-add-trigger.1.txt
CommitLineData
a942557f 1lttng-add-trigger(1)
484b2a0c
PP
2====================
3:revdate: 23 April 2021
a942557f
SM
4
5
6NAME
7----
484b2a0c 8lttng-add-trigger - Add an LTTng trigger
a942557f
SM
9
10
11SYNOPSIS
12--------
a942557f 13[verse]
484b2a0c
PP
14*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-trigger* [option:--name='NAME'] [option:--owner-id='UID']
15 option:--condition='CONDTYPE' ['CONDARGS']
16 option:--action='ACTTYPE' ['ACTARGS'] [option:--action='ACTTYPE' ['ACTARGS']]...
a942557f
SM
17
18DESCRIPTION
19-----------
484b2a0c
PP
20The `lttng add-trigger` command creates and adds an LTTng _trigger_ to
21the session daemon (see man:lttng-sessiond(8)).
22
23A trigger is an association between a _condition_ and one or more
24_actions_. When the condition of a trigger{nbsp}__T__ is satisfied,
25LTTng requests to execute the actions of{nbsp}__T__. Depending on the
26rate policy of an action, an execution request can become an actual
27execution.
a942557f 28
484b2a0c
PP
29A trigger doesn't belong to a specific tracing session: it's global to
30the session daemon. Within the session daemon, and for a given Unix
31user, a trigger has a unique name. By default, the `add-trigger` command
32automatically assigns a name to the added trigger. Use the option:--name
33option to assign a specific name instead.
a942557f 34
484b2a0c
PP
35The `add-trigger` command adds a trigger for your Unix user. If your
36Unix user is `root`, you can add the trigger as another user with the
37option:--owner-id option.
a942557f 38
484b2a0c
PP
39Specify the condition of the trigger to add with a <<cond-spec,condition
40specifier>> and its actions with one or more <<action-spec,action
41specifiers>>. The order of the action specifiers is significant: LTTng
42attempts to execute the actions of a trigger in order.
a942557f 43
484b2a0c
PP
44List the available triggers for your Unix user (or for all users if your
45Unix user is `root`) with the man:lttng-list-triggers(1) command.
a942557f 46
484b2a0c 47Remove an existing trigger with the man:lttng-remove-trigger(1) command.
a942557f 48
a942557f 49
484b2a0c
PP
50[[cond-spec]]
51Condition specifier
52~~~~~~~~~~~~~~~~~~~
53Synopsis:
54
55[verse]
56option:--condition='CONDTYPE' ['CONDARGS']
a942557f 57
484b2a0c
PP
58A condition specifier is the option:--condition option, which specifies
59the type of condition 'CONDTYPE', followed, depending on 'CONDTYPE',
60with zero or more arguments 'CONDARGS'.
61
62The available condition types are:
63
64[[er-matches-cond-spec]]`event-rule-matches`::
65 Synopsis:
66+
67[verse]
68option:--condition=event-rule-matches [nloption:--capture='CDESCR']... 'ERSPEC'
69{nbsp}
943061bd 70+
484b2a0c
PP
71An `event-rule-matches` condition is considered satisfied when the event
72rule specified with 'ERSPEC' matches an event.
73+
74See man:lttng-event-rule(7) to learn how to specify an event rule
75('ERSPEC' part).
76+
77Capture event record and context fields with one or more
78nloption:--capture options (see the <<capture-descr,Capture descriptor>>
79section below to learn more). When an `event-rule-matches` condition
80with capture descriptors is satisfied, the captured field values are
81available in the evaluation object of the condition using the
82liblttng-ctl C{nbsp}API.
83+
84IMPORTANT: Make sure to **single-quote** 'CDESCR' when you run the
85`add-trigger` command from a shell, as capture descriptors can include
86characters having a special meaning for most shells.
943061bd 87
a942557f 88
484b2a0c
PP
89[[capture-descr]]
90Capture descriptor
91~~~~~~~~~~~~~~~~~~
92A capture descriptor is a textual expression which describes how to read
93an event record or context field.
a942557f 94
484b2a0c
PP
95The argument of a nloption:--capture option, when using an
96<<er-matches-cond-spec,``event rule matches'' condition specifier>>
97(`event-rule-matches`), is a capture descriptor.
a942557f 98
484b2a0c 99A capture descriptor expression is one of:
a942557f 100
484b2a0c
PP
101'NAME'::
102 An event record field named 'NAME'.
103+
104The supported event record field types are:
105+
106--
107* Integer
108* Enumeration (integral value)
109* Floating point number
110* Static array of integers
111* Dynamic array (``sequence'') of integers
112* Text string
113--
114+
115Examples: `my_field`, `target_cpu`, `ip`.
a942557f 116
484b2a0c
PP
117++$ctx.++__NAME__::
118 A statically-known context field named 'NAME'.
119+
120List the available statically-known context field names with
121man:lttng-add-context(1).
122+
123Examples: `$ctx.prio`, `$ctx.preemptible`,
124`$ctx.perf:cpu:stalled-cycles-frontend`.
125
126++$app.++__PROVIDER__++.++__NAME__::
127 An application-specific context field named 'NAME' from the
128 provider 'PROVIDER'.
129+
130See man:lttng-add-context(1) to learn more about application-specific
131context fields.
132+
133Example: `$app.server:cur_user`.
a942557f 134
484b2a0c
PP
135__EXPR__++[++__INDEX__++]++::
136 The element at index 'INDEX' of the array field (static or dynamic)
137 identified by the expression 'EXPR'.
138+
139'INDEX' must be a constant, positive integral value.
140+
141Examples: `ip[3]`, `user_ids[15]`.
a942557f 142
484b2a0c
PP
143If, when an event rule matches, a given capture descriptor doesn't
144identify an existing event or context field, then the captured value is
145reported as being unavailable. This applies to:
a942557f 146
484b2a0c
PP
147* A nonexistent event record field name.
148* A nonexistent statically-known context field name.
149* A nonexistent application-specific context field name.
150* An out-of-bounds array field index.
943061bd 151
943061bd 152
484b2a0c
PP
153[[action-spec]]
154Action specifier
155~~~~~~~~~~~~~~~~
156Synopsis:
943061bd 157
484b2a0c
PP
158[verse]
159option:--action='ACTTYPE' ['ACTARGS']
160
161An action specifier is the option:--action option, which specifies
162the type of action 'ACTTYPE', followed, depending on 'ACTTYPE', with zero
163or more arguments 'ACTARGS'.
164
165The available action types are:
166
167Notify::
168 Synopsis:
169+
170[verse]
171option:--action=notify [nloption:--rate-policy='POLICY']
172{nbsp}
173+
174Sends a notification through the notification
175mechanism of the session daemon (see man:lttng-session(8)).
176+
177The session daemon sends details about the condition evaluation along
178with the notification.
179+
180As of LTTng{nbsp}{lttng_version}, you can write a C/pass:[C++] program
181to receive LTTng notifications (see the liblttng-ctl C{nbsp}headers).
182+
183See below for the nloption:--rate-policy option.
943061bd 184
484b2a0c
PP
185Start a tracing session::
186 Synopsis:
187+
188[verse]
189option:--action=start-session 'SESSION' [nloption:--rate-policy='POLICY']
190{nbsp}
191+
192Starts the tracing session named 'SESSION' like man:lttng-start(1)
193would.
194+
195If no tracing session has the name 'SESSION' when LTTng is ready to
196execute the action, LTTng does nothing.
197+
198See below for the nloption:--rate-policy option.
943061bd 199
484b2a0c
PP
200Stop a tracing session::
201 Synopsis:
943061bd 202+
484b2a0c
PP
203[verse]
204option:--action=stop-session 'SESSION' [nloption:--rate-policy='POLICY']
205{nbsp}
943061bd 206+
484b2a0c 207Stops the tracing session named 'SESSION' like man:lttng-stop(1) would.
943061bd 208+
484b2a0c
PP
209If no tracing session has the name 'SESSION' when LTTng is ready to
210execute the action, LTTng does nothing.
943061bd 211+
484b2a0c 212See below for the nloption:--rate-policy option.
943061bd 213
484b2a0c
PP
214Rotate a tracing session::
215 Synopsis:
216+
217[verse]
218option:--action=rotate-session 'SESSION' [nloption:--rate-policy='POLICY']
219{nbsp}
943061bd 220+
484b2a0c
PP
221Archives the current trace chunk of the tracing session named 'SESSION'
222like man:lttng-rotate(1) would.
943061bd 223+
484b2a0c
PP
224If no tracing session has the name 'SESSION' when LTTng is ready to
225execute the action, LTTng does nothing.
943061bd 226+
484b2a0c 227See below for the nloption:--rate-policy option.
943061bd 228
484b2a0c
PP
229Take a tracing session snapshot::
230 Synopsis:
943061bd 231+
484b2a0c
PP
232[verse]
233option:--action=snapshot-session 'SESSION' [nloption:--rate-policy='POLICY']
234{nbsp}
943061bd 235+
484b2a0c
PP
236Takes a snapshot of the tracing session named 'SESSION' like
237man:lttng-snapshot(1) would.
238+
239When the condition of the trigger is satisfied, the tracing session
240named 'SESSION', if any, must be a snapshot-mode tracing session
241(see man:lttng-create(1)).
242+
243If no tracing session has the name 'SESSION' when LTTng is ready to
244execute the action, LTTng does nothing.
245+
246See below for the nloption:--rate-policy option.
247
248Common action options (as of LTTng{nbsp}{lttng_version}):
249
250nloption:--rate-policy='POLICY'::
72d8cc10
PP
251 Set the rate policy of the action to 'POLICY' instead of
252 `every:1` (always execute).
484b2a0c
PP
253+
254A trigger which ``fires'' (its condition is satisfied) leads to an
255execution request for each of its actions, in order. An execution
256request of a given action{nbsp}__A__ first increments the execution
257request count{nbsp}__C__ of{nbsp}__A__. An execution request can then
258become an actual execution when{nbsp}__C__ satisfies the rate policy
259of{nbsp}__A__.
260+
484b2a0c
PP
261'POLICY' is one of:
262+
263--
264++once-after:++__COUNT__::
265 Only execute{nbsp}__A__ when{nbsp}__C__ is equal to 'COUNT'.
266+
267In other words, execute{nbsp}__A__ a single time after 'COUNT' execution
268requests.
269
270++every:++__COUNT__::
271 Only execute{nbsp}__A__ when{nbsp}__C__ is a multiple of 'COUNT'.
272+
273In other words, execute{nbsp}__A__ every 'COUNT' execution requests.
274--
275+
72d8cc10
PP
276'COUNT' must be an integer greater than{nbsp}0.
277+
484b2a0c
PP
278As of LTTng{nbsp}{lttng_version}, you can use this option with any
279action type, but new action types in the future may not support it.
943061bd
JR
280
281
a942557f
SM
282OPTIONS
283-------
484b2a0c
PP
284Identification
285~~~~~~~~~~~~~~
286option:--name='NAME'::
287 Set the unique name of the trigger to add to 'NAME' instead of the
288 `add-trigger` command automatically assigning one.
289
290option:--owner-id='UID'::
291 Add the trigger as the Unix user having the user ID 'UID'.
292+
293You may only use this option if your Unix user is `root`.
a942557f 294
d0a70fd5 295
484b2a0c
PP
296Specifier
297~~~~~~~~~
298option:--condition='CONDTYPE'::
299 Introductory option for a condition specifier of type 'CONDTYPE'.
a942557f 300+
484b2a0c 301See the <<cond-spec,Condition specifier>> section above to learn more.
a942557f 302
484b2a0c
PP
303option:--action='ACTTYPE'::
304 Introductory option for an action specifier of type 'ACTTYPE'.
305+
306See the <<action-spec,Action specifier>> section above to learn more.
a942557f 307
a942557f
SM
308
309include::common-cmd-help-options.txt[]
310
311
312include::common-cmd-footer.txt[]
313
314
315SEE ALSO
316--------
484b2a0c 317man:lttng(1),
a942557f 318man:lttng-list-triggers(1),
484b2a0c 319man:lttng-remove-trigger(1)
This page took 0.036349 seconds and 4 git commands to generate.