Fix: add-context cannot be performed after a session has been started
[lttng-tools.git] / doc / man / lttng-add-context.1.txt
1 lttng-add-context(1)
2 ====================
3
4
5 NAME
6 ----
7 lttng-add-context - Add context fields to an LTTng channel
8
9
10 SYNOPSIS
11 --------
12 Add context fields to a channel:
13
14 [verse]
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']...
19
20 List the available context fields:
21
22 [verse]
23 *lttng* ['linkgenoptions:(GENERAL OPTIONS)'] *add-context* option:--list
24
25
26 DESCRIPTION
27 -----------
28 The `lttng add-context` command adds one or more context fields to a
29 channel.
30
31 Channels are created with the man:lttng-enable-channel(1) command.
32
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.
35
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.
39
40 Many context fields can be added to a channel at once by repeating the
41 option:--type option.
42
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.
47
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:
51
52 `N`::
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.
57
58 `NAME`::
59 Custom name to easily recognize the counter.
60
61 Application-specific context fields can be added to a channel using the
62 following syntax:
63
64 [verse]
65 $app.'PROVIDER':__TYPE__
66
67 with:
68
69 'PROVIDER'::
70 Provider name.
71
72 'TYPE'::
73 Context type name.
74
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
77 most shells.
78
79 Use the option:--list option without other arguments to list the
80 available context field names.
81
82
83 include::common-cmd-options-head.txt[]
84
85
86 Domain
87 ~~~~~~
88 One of:
89
90 option:-j, option:--jul::
91 Add context to channel in the `java.util.logging` (JUL) domain.
92
93 option:-k, option:--kernel::
94 Add context to channel in the Linux kernel domain.
95
96 option:-l, option:--log4j::
97 Add context to channel in the Apache log4j domain.
98
99 option:-u, option:--userspace::
100 Add context to channel in the user space domain.
101
102
103 Target
104 ~~~~~~
105 option:-c 'CHANNEL', option:--channel='CHANNEL'::
106 Add context fields to a channel named 'CHANNEL' instead of adding
107 them to all the channels.
108
109 option:-s 'SESSION', option:--session='SESSION'::
110 Add context fields to a channel in the tracing session named 'SESSION'
111 instead of the current tracing session.
112
113
114 Context
115 ~~~~~~~
116 option:--list::
117 List the available context fields. Use this option alone.
118
119 option:-t 'TYPE', option:--type='TYPE'::
120 Add context field named 'TYPE'. This option can be repeated as
121 many times as needed on the command-line.
122
123
124 include::common-cmd-help-options.txt[]
125
126
127 include::common-cmd-footer.txt[]
128
129
130 SEE ALSO
131 --------
132 man:lttng(1)
This page took 0.031792 seconds and 4 git commands to generate.