3 :revdate: 5 Februrary 2018
8 lttng-add-context - Add context fields to an LTTng channel
13 Add context fields to a channel:
16 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context*
17 (option:--kernel | option:--userspace | option:--jul | option:--log4j)
18 [option:--session='SESSION'] [option:--channel='CHANNEL']
19 option:--type='TYPE' [option:--type='TYPE']...
21 List the available context fields:
24 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context* option:--list
29 The `lttng add-context` command adds one or more context fields to a
32 Channels are created with the man:lttng-enable-channel(1) command.
34 When context fields are added to a channel, all the events emitted
35 within this channel contain the dynamic values of those context fields.
37 If the option:--session option is omitted, the current tracing session
38 is used. If the option:--channel option is omitted, the context fields
39 are added to all the selected tracing session's channels.
41 Many context fields can be added to a channel at once by repeating the
44 perf counters are available as per-CPU (`perf:cpu:` prefix) as well as
45 per-thread (`perf:thread:` prefix) counters. Currently, per-CPU counters
46 can only be used in the Linux kernel tracing domain, while per-thread
47 counters can only be used in the user space tracing domain.
49 It is also possible to enable PMU counters by raw ID using the
50 `perf:cpu:raw:rN:NAME` (Linux kernel tracing domain) or
51 `perf:thread:raw:rN:NAME` (user space tracing domain), with:
54 A hexadecimal event descriptor which is the same format as used
55 by man:perf-record(1): a concatenation of the event number and umask
56 value provided by the processor's manufacturer. The possible values
57 for this field are processor-specific.
60 Custom name to easily recognize the counter.
62 Application-specific context fields can be added to a channel using the
66 $app.'PROVIDER':__TYPE__
76 NOTE: Make sure to **single-quote** the type when running the command
77 from a shell, as `$` is a special character for variable substitution in
80 Use the option:--list option without other arguments to list the
81 available context field names.
83 See the <<limitations,LIMITATIONS>> section below for a list of
84 limitations to consider.
86 include::common-cmd-options-head.txt[]
93 option:-j, option:--jul::
94 Add context to channel in the `java.util.logging` (JUL) domain.
96 option:-k, option:--kernel::
97 Add context to channel in the Linux kernel domain.
99 option:-l, option:--log4j::
100 Add context to channel in the Apache log4j domain.
102 option:-u, option:--userspace::
103 Add context to channel in the user space domain.
108 option:-c 'CHANNEL', option:--channel='CHANNEL'::
109 Add context fields to a channel named 'CHANNEL' instead of adding
110 them to all the channels.
112 option:-s 'SESSION', option:--session='SESSION'::
113 Add context fields to a channel in the tracing session named 'SESSION'
114 instead of the current tracing session.
120 List the available context fields. Use this option alone.
122 option:-t 'TYPE', option:--type='TYPE'::
123 Add context field named 'TYPE'. This option can be repeated as
124 many times as needed on the command-line.
127 include::common-cmd-help-options.txt[]
132 As of this version of LTTng, it is not possible to add context fields to
133 a channel once its tracing session has been started (see man:lttng-start(1))
136 include::common-cmd-footer.txt[]