add-trigger: rename --fire-* to --rate-policy=*:value
[lttng-tools.git] / doc / man / lttng-add-trigger.1.txt
CommitLineData
a942557f
SM
1lttng-add-trigger(1)
2=====================
943061bd 3:revdate: 27 May 2020
a942557f
SM
4
5
6NAME
7----
8lttng-add-trigger - Create LTTng triggers
9
10
11SYNOPSIS
12--------
13
14[verse]
15*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-trigger* [--id ID]
a942557f
SM
16 --condition CONDITION-NAME CONDITION-ARGS
17 --action ACTION-NAME ACTION-ARGS
18 [--action ACTION-NAME ACTION-ARGS]...
19
20
21DESCRIPTION
22-----------
23
24The `lttng add-trigger` command is used to create triggers. A
25trigger is an association between a *condition* and one or more
26*actions*. When the condition associated to a trigger is met, the
27actions associated to that trigger are executed. The tracing does not
28have to be active for the conditions to be met, and triggers are
29independent from tracing sessions.
30
a942557f
SM
31The syntax by which conditions and actions are specified is described
32below.
33
d0a70fd5 34[[conditions]]
a942557f
SM
35Conditions
36~~~~~~~~~~
37
38Conditions are specified with the `--condition` option, followed by a
39condition name, and possibly some more arguments, depending on the
40specific condition. There must be exactly one condition given in the
41`lttng add-trigger` invocation.
42
43The available conditions are:
44
45Event rule: `on-event [event rule arguments]`::
46 This type of condition is met when the tracer encounters an event
47 matching the given even rule. The arguments describing the event
48 rule are the same as those describing the event rules of the
49 man:lttng-enable-event(1) command, with these exceptions:
50
51 - It is not possible to use filter operands that use values from
52 the context.
53
943061bd
JR
54+
55Fields to capture can be specified with the option:--capture option, followed by
56a capture expression. Zero or more captures can be configured. See the
57<<capture-expr, Capture expression>> section below for more information.
58
d0a70fd5 59[[actions]]
a942557f
SM
60Actions
61~~~~~~~
62
63Actions are specified with the `--action` option, followed by an action
64name, and possibly some more arguments, depending on the specific
65action. There must be at least one action given in the
66`lttng add-trigger` invocation.
67
68The available actions are:
69
70Notify: *notify*::
71 This action causes the LTTng session daemon to send a notification,
72 through its notification mechanism (see man:lttng-sessiond(8)).
73 Some details about the condition evaluation are sent along with the
74 notification.
75
76Start session: *start-session* session-name::
77 This action causes the LTTng session daemon to start tracing for the
78 session with the given name. If no session with the given name exist
79 at the time the condition is met, nothing is done.
80
81Stop session: *stop-session* session-name::
82 This action causes the LTTng session daemon to stop tracing for the
83 session with the given name. If no session with the given name exist
84 at the time the condition is met, nothing is done.
85
86Rotate session: *rotate-session* session-name::
87 This action causes the LTTng session daemon to rotate the session
88 with the given name. See man:lttng-rotate(1) for more information
89 about the session rotation concept. If no session with the given
90 name exist at the time the condition is met, nothing is done.
91
92Snapshot session: *snapshot-session* session-name::
93 This action causes the LTTng session daemon to take a snapshot of the
94 session with the given name. See man:lttng-snapshot(1) for more
95 information about the session snapshot concept. If no session with
96 the given name exist at the time the condition is met, nothing is
97 done.
98
943061bd
JR
99
100[[capture-expr]]
101Capture expression
102~~~~~~~~~~~~~~~~~~
103
104A capture expression can be specified with the option:--capture option when
105creating a new on-event condition. If the capture expression corresponds with an
106event's field when tracing, the runtime dynamic value corresponding to the
107capture expression is captured.
108
109NOTE: Make sure to **single-quote** the capture expression when running
110the command from a shell, as capture expressions typically include
111characters having a special meaning for most shells.
112
113* Supported field types:
114 - integer,
115 - unsigned integer,
116 - floating point value,
117 - fixed-size array of integers,
118 - variable-size array of integers (sequence),
119 - enumeration,
120 - text string,
121 - element of any allowing previous type.
122
123* The dynamic value of an event field is captured by using its name as a C
124 identifier.
125+
126The square bracket notation is available, like in the C
127language, to access array/sequence field.
128Only a constant, positive integer number can be used within square
129brackets. If the index is out of bounds, the capture expression
130evaluates to `unavailable`.
131+
132An enumeration field's value is an integer.
133+
134When the capture's field does not exist, the capture expression
135evaluates to `unavailable`.
136+
137Examples: `my_field`, `target_cpu`, `seq[7]`
138
139* The dynamic value of a statically-known context field is captured by
140 prefixing its name with `$ctx.`. See man:lttng-add-context(1) to get a list of
141 available contexts.
142+
143When the expression's statically-known context field does not exist,
144the capture expression evaluates to `unavailable`.
145+
146Examples: `$ctx.prio`, `$ctx.preemptible`,
147`$ctx.perf:cpu:stalled-cycles-frontend`.
148+
149NOTE: The statically-known context field does NOT need to be added using the
150man:lttng-add-context(1) command. The statically-known context fields are
151always available in the context of triggers.
152
153* The dynamic value of an application-specific context field is captured by
154 prefixing its name with `$app.` (follows the format used to add such a context
155 field with the man:lttng-add-context(1) command).
156+
157When the expression's application-specific context field does not exist,
158the capture expression evaluates to `unavailable`.
159+
160Example: `$app.server:cur_user`.
161+
162NOTE: The application-specific context field does NOT need to be added using the
163man:lttng-add-context(1) command. The application-specific context fields fields
164are always available in the context of triggers.
165
166
a942557f
SM
167OPTIONS
168-------
169
d0a70fd5
SM
170option:--condition::
171 Define the condition for the trigger. See the
172 <<conditions,CONDITIONS>> section for more details.
173
174option:--action::
175 Define an action for the trigger. See the <<actions,ACTIONS>>
176 section for more details.
177
a942557f
SM
178option:--id='ID'::
179 Set the id of the trigger to 'ID'. If omitted, an id will
180 automatically be assigned to the trigger by the session daemon.
181+
182If a trigger with the specified 'ID' already exists, the trigger
183creation will fail.
184
185option:--fire-every 'N'::
186 Execute the trigger's actions every 'N' times the condition is met.
187
188option:--fire-once-after 'N'::
189 Execute the trigger's actions once after 'N' times the condition is
190 met, then never after that.
191
192include::common-cmd-help-options.txt[]
193
194
195include::common-cmd-footer.txt[]
196
197
198SEE ALSO
199--------
200man:lttng-list-triggers(1),
201man:lttng-remove-trigger(1),
202man:lttng(1)
This page took 0.029874 seconds and 4 git commands to generate.