Rename "tracing session" -> "recording session"
[lttng-tools.git] / doc / man / lttng-add-context.1.txt
... / ...
CommitLineData
1lttng-add-context(1)
2====================
3:revdate: 14 June 2021
4
5
6NAME
7----
8lttng-add-context - Add context fields to be recorded by LTTng
9
10
11SYNOPSIS
12--------
13Add context fields to be recorded to the event records of one or more
14channels:
15
16[verse]
17*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context*
18 (option:--kernel | option:--userspace | option:--jul | option:--log4j)
19 [option:--session='SESSION'] [option:--channel='CHANNEL']
20 option:--type='TYPE' [option:--type='TYPE']...
21
22List the available context field types:
23
24[verse]
25*lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context* option:--list
26
27
28DESCRIPTION
29-----------
30The `lttng add-context` command can:
31
32Without the option:--list option::
33 Add one or more context fields to be recorded by LTTng to the event
34 records of:
35+
36With the option:--session='SESSION' option:::
37 The recording session named 'SESSION'.
38
39Without the option:--session option:::
40 The current recording session (see man:lttng-concepts(7) to learn
41 more about the current recording session).
42
43With the option:--channel='CHANNEL':::
44 The channel named 'CHANNEL'.
45
46Without the option:--channel option:::
47 *All* the channels of the selected recording session.
48
49With the option:--list option::
50 List the available context field types.
51
52See man:lttng-concepts(7) to learn more about recording sessions and
53channels.
54
55Repeat the option:--type='TYPE' option to add more than one context
56field to be recorded. 'TYPE' is one of:
57
58* A statically-known, or built-in context field named.
59
60* A perf counter name:
61+
62--
63Per-CPU::
64 Prefix: `perf:cpu:`
65+
66Only available with the option:--kernel option.
67
68Per-thread::
69 Prefix: `perf:thread:`
70+
71Only available with the option:--userspace, option:--jul, or
72option:--log4j option.
73--
74+
75Add Performance Monitoring Unit (PMU) counter context fields by raw ID
76with the ++perf:cpu:raw:r++__N__++:++__NAME__ (option:--kernel option)
77or ++perf:thread:raw:r++__N__++:++__NAME__ (option:--userspace,
78option:--jul, or option:--log4j option) types, with:
79+
80--
81'N'::
82 A hexadecimal event descriptor which follows the man:perf-record(1)
83 format: a concatenation of the event number and umask value which
84 the manufacturer of the processor provides.
85+
86The possible values for this part are processor-specific.
87
88'NAME'::
89 Custom name to identify the counter.
90--
91
92* An LTTng application-specific context field name:
93+
94--
95[verse]
96$app.'PROVIDER':__TYPE__
97+
98'PROVIDER'::
99 Provider name.
100
101'TYPE'::
102 Context type name.
103--
104+
105Only available with the option:--jul and option:--log4j options.
106
107IMPORTANT: Make sure to **single-quote** 'TYPE' when you run the
108`add-context` command from a shell, as `$` is a special character for
109variable substitution in most shells.
110
111NOTE: As of LTTng{nbsp}{lttng_version}, you may :not: add context fields
112to be recorded to the event records of a given channel once its
113recording session has been started (see man:lttng-start(1)) at least
114once.
115
116See the ``<<examples,EXAMPLES>>'' section below for usage examples.
117
118
119include::common-lttng-cmd-options-head.txt[]
120
121
122Tracing domain
123~~~~~~~~~~~~~~
124One of:
125
126option:-j, option:--jul::
127 Add context fields to be recorded to the event records of one or
128 more channels of the `java.util.logging` (JUL) tracing domain.
129
130option:-k, option:--kernel::
131 Add context fields to be recorded to the event records of one or
132 more channels of the Linux kernel tracing domain.
133
134option:-l, option:--log4j::
135 Add context fields to be recorded to the event records of one or
136 more channels of the Apache log4j tracing domain.
137
138option:-u, option:--userspace::
139 Add context fields to be recorded to the event records of one or
140 more channels of the user space tracing domain.
141
142
143Recording target
144~~~~~~~~~~~~~~~~
145option:-c 'CHANNEL', option:--channel='CHANNEL'::
146 Add context fields to be recorded to the event records of a channel
147 named 'CHANNEL' instead of all the channels of the selected
148 recording session.
149
150option:-s 'SESSION', option:--session='SESSION'::
151 Add context fields to be recorded to the event records of one or
152 more channels of the recording session named 'SESSION' instead of
153 the current recording session.
154
155
156Context field type
157~~~~~~~~~~~~~~~~~~
158option:--list::
159 List the available context field types.
160+
161You may :not: use this option with the option:--channel,
162option:--session, or option:--type options.
163
164option:-t 'TYPE', option:--type='TYPE'::
165 Add a context field having the type 'TYPE' to be recorded.
166+
167Repeat this option to add more than one context field.
168
169
170include::common-lttng-cmd-help-options.txt[]
171
172
173include::common-lttng-cmd-after-options.txt[]
174
175
176[[examples]]
177EXAMPLES
178--------
179.List the available context field types.
180====
181See the option:--list option.
182
183[role="term"]
184----
185$ lttng add-context --list
186----
187====
188
189.Add a single statically-known context field to be recorded to all the Linux kernel channels of the current recording session.
190====
191[role="term"]
192----
193$ lttng add-context --kernel --type=pid
194----
195====
196
197.Add three statically-known context fields to be recorded to a specific user space channel of a specific recording session.
198====
199See the option:--session and option:--channel options.
200
201[role="term"]
202----
203$ lttng add-context --userspace --session=my-session \
204 --channel=my-channel \
205 --type=vpid --type=procname --type=ip
206----
207====
208
209.Add a perf counter context field to be recorded to a specific Linux kernel channel of the current recording session.
210====
211See the option:--channel option.
212
213[role="term"]
214----
215$ lttng add-context --kernel --channel=my-channel \
216 --type=perf:cpu:cache-misses
217----
218====
219
220.Add an LTTng application-specific context field to be recorded to all the JUL channels of the current recording session.
221====
222[role="term"]
223----
224$ lttng add-context --jul --type='$app.my_server:user_cnt'
225----
226====
227
228
229include::common-footer.txt[]
230
231
232SEE ALSO
233--------
234man:lttng(1),
235man:lttng-enable-channel(1),
236man:lttng-concepts(7)
This page took 0.024801 seconds and 4 git commands to generate.