8 lttng-add-trigger - Add an LTTng trigger
14 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-trigger* [option:--name='NAME'] [option:--owner-uid='UID']
15 option:--condition='CONDTYPE' ['CONDARGS']
16 option:--action='ACTTYPE' ['ACTARGS'] [option:--action='ACTTYPE' ['ACTARGS']]...
20 The `lttng add-trigger` command creates and adds an LTTng _trigger_ to
21 the connected session daemon (see man:lttng-sessiond(8)).
23 See man:lttng-concepts(7) to learn more about LTTng triggers.
25 By default, the `add-trigger` command automatically assigns a name,
26 unique for a given session daemon and Unix user, to the added trigger.
27 Assign a custom name with the option:--name.
29 The `add-trigger` command adds a trigger for your Unix user. If your
30 Unix user is `root`, you may add the trigger as another user with the
31 option:--owner-uid option.
33 Specify the condition of the trigger to add with a <<cond-spec,condition
34 specifier>> and its actions with one or more <<action-spec,action
35 specifiers>>. The order of the action specifiers is significant: LTTng
36 attempts to execute the actions of a firing trigger in this order.
38 List the triggers of your Unix user, or of all users if your
39 Unix user is `root`, with the man:lttng-list-triggers(1) command.
41 Remove a trigger with the man:lttng-remove-trigger(1) command.
50 option:--condition='CONDTYPE' ['CONDARGS']
52 A condition specifier is the option:--condition option, which specifies
53 the type of condition 'CONDTYPE', followed, depending on 'CONDTYPE',
54 with zero or more arguments 'CONDARGS'.
56 The available condition types are:
58 [[er-matches-cond-spec]]`event-rule-matches`::
62 option:--condition=**event-rule-matches** [nloption:--capture='CDESCR']... 'ERSPEC'
65 An `event-rule-matches` condition is considered satisfied when the event
66 rule specified with 'ERSPEC' matches an event.
68 See man:lttng-event-rule(7) to learn how to specify an event rule
71 Capture event record and context fields with one or more
72 nloption:--capture options (see the <<capture-descr,Capture descriptor>>
73 section below to learn more). When an `event-rule-matches` condition
74 with capture descriptors is satisfied, the captured field values are
75 available in the evaluation object of the condition using the
76 liblttng-ctl C{nbsp}API.
78 IMPORTANT: Make sure to **single-quote** 'CDESCR' when you run the
79 `add-trigger` command from a shell, as capture descriptors can include
80 characters having a special meaning for most shells.
86 A capture descriptor is a textual expression which describes how to read
87 an event record or context field.
89 The argument of a nloption:--capture option, when using an
90 <<er-matches-cond-spec,``event rule matches'' condition specifier>>
91 (`event-rule-matches`), is a capture descriptor.
93 A capture descriptor expression is one of:
96 An event record field named 'NAME'.
98 The supported event record field types are:
102 * Enumeration (integral value)
103 * Floating point number
104 * Static array of integers
105 * Dynamic array (``sequence'') of integers
109 Examples: `my_field`, `target_cpu`, `ip`.
112 A statically-known context field named 'NAME'.
114 List the available statically-known context field names with
115 man:lttng-add-context(1).
117 Examples: `$ctx.prio`, `$ctx.preemptible`,
118 `$ctx.perf:cpu:stalled-cycles-frontend`.
120 ++$app.++__PROVIDER__++.++__NAME__::
121 An application-specific context field named 'NAME' from the
124 See man:lttng-add-context(1) to learn more about application-specific
127 Example: `$app.server:cur_user`.
129 __EXPR__++[++__INDEX__++]++::
130 The element at index 'INDEX' of the array field (static or dynamic)
131 identified by the expression 'EXPR'.
133 'INDEX' must be a constant, positive integral value.
135 Examples: `ip[3]`, `user_ids[15]`.
137 If, when an event rule matches, a given capture descriptor doesn't
138 identify an existing event or context field, then the captured value is
139 reported as being unavailable. This applies to:
141 * A nonexistent event record field name.
142 * A nonexistent statically-known context field name.
143 * A nonexistent application-specific context field name.
144 * An out-of-bounds array field index.
153 option:--action='ACTTYPE' ['ACTARGS']
155 An action specifier is the option:--action option, which specifies
156 the type of action 'ACTTYPE', followed, depending on 'ACTTYPE', with zero
157 or more arguments 'ACTARGS'.
159 The available action types are:
165 option:--action=**notify** [nloption:--rate-policy='POLICY']
168 Sends a notification through the notification
169 mechanism of the session daemon (see man:lttng-session(8)).
171 The session daemon sends details about the condition evaluation along
172 with the notification.
174 As of LTTng{nbsp}{lttng_version}, you can write a C/pass:[C++] program
175 to receive LTTng notifications (see the liblttng-ctl C{nbsp}headers).
177 See below for the nloption:--rate-policy option.
179 Start a tracing session::
183 option:--action=**start-session** 'SESSION' [nloption:--rate-policy='POLICY']
186 Starts the tracing session named 'SESSION' like man:lttng-start(1)
189 If no tracing session has the name 'SESSION' when LTTng is ready to
190 execute the action, LTTng does nothing.
192 See below for the nloption:--rate-policy option.
194 Stop a tracing session::
198 option:--action=**stop-session** 'SESSION' [nloption:--rate-policy='POLICY']
201 Stops the tracing session named 'SESSION' like man:lttng-stop(1) would.
203 If no tracing session has the name 'SESSION' when LTTng is ready to
204 execute the action, LTTng does nothing.
206 See below for the nloption:--rate-policy option.
208 Rotate a tracing session::
212 option:--action=**rotate-session** 'SESSION' [nloption:--rate-policy='POLICY']
215 Archives the current trace chunk of the tracing session named 'SESSION'
216 like man:lttng-rotate(1) would.
218 If no tracing session has the name 'SESSION' when LTTng is ready to
219 execute the action, LTTng does nothing.
221 See below for the nloption:--rate-policy option.
223 Take a tracing session snapshot::
227 option:--action=**snapshot-session** 'SESSION' [nloption:--rate-policy='POLICY']
230 Takes a snapshot of the tracing session named 'SESSION' like
231 man:lttng-snapshot(1) would.
233 When the condition of the trigger is satisfied, the tracing session
234 named 'SESSION', if any, must be a snapshot-mode tracing session
235 (see man:lttng-create(1)).
237 If no tracing session has the name 'SESSION' when LTTng is ready to
238 execute the action, LTTng does nothing.
240 See below for the nloption:--rate-policy option.
242 Common action options (as of LTTng{nbsp}{lttng_version}):
244 nloption:--rate-policy='POLICY'::
245 Set the rate policy of the action to 'POLICY' instead of
246 `every:1` (always execute).
248 A trigger which ``fires'' (its condition is satisfied) leads to an
249 execution request for each of its actions, in order. An execution
250 request of a given action{nbsp}__A__ first increments the execution
251 request count{nbsp}__C__ of{nbsp}__A__. An execution request can then
252 become an actual execution when{nbsp}__C__ satisfies the rate policy
258 ++once-after:++__COUNT__::
259 Only execute{nbsp}__A__ when{nbsp}__C__ is equal to 'COUNT'.
261 In other words, execute{nbsp}__A__ a single time after 'COUNT' execution
264 ++every:++__COUNT__::
265 Only execute{nbsp}__A__ when{nbsp}__C__ is a multiple of 'COUNT'.
267 In other words, execute{nbsp}__A__ every 'COUNT' execution requests.
270 'COUNT' must be an integer greater than{nbsp}0.
272 As of LTTng{nbsp}{lttng_version}, you can use this option with any
273 action type, but new action types in the future may not support it.
280 option:--name='NAME'::
281 Set the unique name of the trigger to add to 'NAME' instead of the
282 `add-trigger` command automatically assigning one.
284 option:--owner-uid='UID'::
285 Add the trigger as the Unix user having the user ID 'UID'.
287 You may only use this option if your Unix user is `root`.
292 option:--condition='CONDTYPE'::
293 Introductory option for a condition specifier of type 'CONDTYPE'.
295 See the <<cond-spec,Condition specifier>> section above to learn more.
297 option:--action='ACTTYPE'::
298 Introductory option for an action specifier of type 'ACTTYPE'.
300 See the <<action-spec,Action specifier>> section above to learn more.
303 include::common-cmd-help-options.txt[]
306 include::common-cmd-footer.txt[]
312 man:lttng-concepts(7),
313 man:lttng-list-triggers(1),
314 man:lttng-remove-trigger(1)