7 lttng-add-context - Add context fields to an LTTng channel
12 Add context fields to a channel:
15 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context*
16 (option:--kernel | option:--userspace | option:--jul | option:--log4j)
17 [option:--session='SESSION'] [option:--channel='CHANNEL']
18 option:--type='TYPE' [option:--type='TYPE']...
20 List the available context fields:
23 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context* option:--list
28 The `lttng add-context` command adds one or more context fields to a
31 Channels are created with the man:lttng-enable-channel(1) command.
33 When context fields are added to a channel, all the events emitted
34 within this channel contain the dynamic values of those context fields.
36 If the option:--session option is omitted, the current tracing session
37 is used. If the option:--channel option is omitted, the context fields
38 are added to all the selected tracing session's channels.
40 Many context fields can be added to a channel at once by repeating the
43 perf counters are available as per-CPU (`perf:cpu:` prefix) as well as
44 per-thread (`perf:thread:` prefix) counters. Currently, per-CPU counters
45 can only be used in the Linux kernel tracing domain, while per-thread
46 counters can only be used in the user space tracing domain.
48 It is also possible to enable PMU counters by raw ID using the
49 `perf:cpu:raw:rN:NAME` (Linux kernel tracing domain) or
50 `perf:thread:raw:rN:NAME` (user space tracing domain), with:
53 A hexadecimal event descriptor which is the same format as used
54 by man:perf-record(1): a concatenation of the event number and umask
55 value provided by the processor's manufacturer. The possible values
56 for this field are processor-specific.
59 Custom name to easily recognize the counter.
61 Application-specific context fields can be added to a channel using the
65 $app.'PROVIDER':__TYPE__
75 NOTE: Make sure to **single-quote** the type when running the command
76 from a shell, as `$` is a special character for variable substitution in
79 Use the option:--list option without other arguments to list the
80 available context field names.
82 See the <<limitations,LIMITATIONS>> section below for a list of
83 limitations to consider.
85 include::common-cmd-options-head.txt[]
92 option:-j, option:--jul::
93 Add context to channel in the `java.util.logging` (JUL) domain.
95 option:-k, option:--kernel::
96 Add context to channel in the Linux kernel domain.
98 option:-l, option:--log4j::
99 Add context to channel in the Apache log4j domain.
101 option:-u, option:--userspace::
102 Add context to channel in the user space domain.
107 option:-c 'CHANNEL', option:--channel='CHANNEL'::
108 Add context fields to a channel named 'CHANNEL' instead of adding
109 them to all the channels.
111 option:-s 'SESSION', option:--session='SESSION'::
112 Add context fields to a channel in the tracing session named 'SESSION'
113 instead of the current tracing session.
119 List the available context fields. Use this option alone.
121 option:-t 'TYPE', option:--type='TYPE'::
122 Add context field named 'TYPE'. This option can be repeated as
123 many times as needed on the command-line.
126 include::common-cmd-help-options.txt[]
131 As of this version of LTTng, it is not possible to add context fields to
132 a channel once its tracing session has been started (see man:lttng-start(1))
135 include::common-cmd-footer.txt[]