Commit | Line | Data |
---|---|---|
5e0cbfb0 PP |
1 | --- |
2 | id: lttng-sessiond | |
3 | --- | |
4 | ||
5 | At the heart of LTTng's plumbing is the _session daemon_, often called | |
6 | by its command name, `lttng-sessiond`. | |
7 | ||
8 | The session daemon is responsible for managing tracing sessions and | |
9 | what they logically contain (channel properties, enabled/disabled | |
10 | events, etc.). By communicating locally with instrumented applications | |
11 | (using LTTng-UST) and with the LTTng Linux kernel modules | |
12 | (LTTng-modules), it oversees all tracing activities. | |
13 | ||
14 | One of the many things that `lttng-sessiond` does is to keep | |
15 | track of the available event types. User space applications and | |
16 | libraries actively connect and register to the session daemon when they | |
17 | start. By contrast, `lttng-sessiond` seeks out and loads the appropriate | |
18 | LTTng kernel modules as part of its own initialization. Kernel event | |
19 | types are _pulled_ by `lttng-sessiond`, whereas user space event types | |
20 | are _pushed_ to it by the various user space tracepoint providers. | |
21 | ||
22 | Using a specific inter-process communication protocol with Linux kernel | |
23 | and user space tracers, the session daemon can send channel information | |
24 | so that they are initialized, enable/disable specific probes based on | |
25 | enabled/disabled events by the user, send event filters information to | |
26 | LTTng tracers so that filtering actually happens at the tracer site, | |
27 | start/stop tracing a specific application or the Linux kernel, etc. | |
28 | ||
29 | The session daemon is not useful without some user controlling it, | |
30 | because it's only a sophisticated control interchange and thus | |
31 | doesn't make any decision on its own. `lttng-sessiond` opens a local | |
32 | socket for controlling it, albeit the preferred way to control it is | |
33 | using `liblttng-ctl`, an installed C library hiding the communication | |
34 | protocol behind an easy-to-use API. The `lttng` tool makes use of | |
35 | `liblttng-ctl` to implement a user-friendly command line interface. | |
36 | ||
37 | `lttng-sessiond` does not receive any trace data from instrumented | |
38 | applications; the _consumer daemons_ are the programs responsible for | |
39 | collecting trace data using shared ring buffers. However, the session | |
40 | daemon is the one that must spawn a consumer daemon and establish | |
41 | a control communication with it. | |
42 | ||
43 | Session daemons run on a per-user basis. Knowing this, multiple | |
44 | instances of `lttng-sessiond` may run simultaneously, each belonging | |
45 | to a different user and each operating independently of the others. | |
46 | Only `root`'s session daemon, however, may control LTTng kernel modules | |
47 | (i.e. the kernel tracer). With that in mind, if a user has no root | |
48 | access on the target system, he cannot trace the system's kernel, but | |
49 | should still be able to trace its own instrumented applications. | |
50 | ||
51 | It has to be noted that, although only `root`'s session daemon may | |
52 | control the kernel tracer, the `lttng-sessiond` command has a `--group` | |
53 | option which may be used to specify the name of a special user group | |
54 | allowed to communicate with `root`'s session daemon and thus record | |
55 | kernel traces. By default, this group is named `tracing`. | |
56 | ||
57 | If not done yet, the `lttng` tool, by default, automatically starts a | |
58 | session daemon. `lttng-sessiond` may also be started manually: | |
59 | ||
60 | <pre class="term"> | |
61 | lttng-sessiond | |
62 | </pre> | |
63 | ||
64 | This will start the session daemon in foreground. Use | |
65 | ||
66 | <pre class="term"> | |
67 | lttng-sessiond --daemonize | |
68 | </pre> | |
69 | ||
70 | to start it as a true daemon. | |
71 | ||
72 | To kill the current user's session daemon, `pkill` may be used: | |
73 | ||
74 | <pre class="term"> | |
75 | pkill lttng-sessiond | |
76 | </pre> | |
77 | ||
78 | The default `SIGTERM` signal will terminate it cleanly. | |
79 | ||
80 | Several other options are available and described in | |
81 | <a href="/man/8/lttng-sessiond" class="ext"><code>lttng-sessiond</code>'s manpage</a> | |
82 | or by running `lttng-sessiond --help`. |