Add sinces
[lttng-docs.git] / contents / using-lttng / controlling-tracing / lttng-live.md
1 ---
2 id: lttng-live
3 since: 2.4
4 ---
5
6 We have seen how trace files may be produced by LTTng out of generated
7 application and Linux kernel events. We have seen that those trace files
8 may be either recorded locally by consumer daemons or remotely using
9 a relay daemon. And we have seen that the maximum size and count of
10 trace files is configurable for each channel. With all those features,
11 it's still not possible to read a trace file as it is being written
12 because it could be incomplete and appear corrupted to the viewer.
13 There is a way to view events as they arrive, however: using
14 _LTTng live_.
15
16 LTTng live is implemented, in LTTng, solely on the relay daemon side.
17 As trace data is sent over the network to a relay daemon by a (possibly
18 remote) consumer daemon, a _tee_ is created: trace data is recorded to
19 trace files _as well as_ being transmitted to a connected live viewer:
20
21 <figure class="img img-100">
22 <img src="/images/docs26/lttng-live.png" alt="LTTng live">
23 <figcaption>
24 The relay daemon creates a <em>tee</em>, forwarding the trace data
25 to both trace files and a live viewer.
26 </figcaption>
27 </figure>
28
29 In order to use this feature, a tracing session must created in live
30 mode on the target system:
31
32 <pre class="term">
33 lttng create --live
34 </pre>
35
36 An optional parameter may be passed to `--live` to set the period
37 (in microseconds) between flushes to the network
38 (1&nbsp;second is the default). With:
39
40 <pre class="term">
41 lttng create --live 100000
42 </pre>
43
44 the daemons flush their data every 100&nbsp;ms.
45
46 If no network output is specified to the `create` command, a local
47 relay daemon is spawned. In this very common case, viewing a live
48 trace is easy: enable events and start tracing as usual, then use
49 `lttng view` to start the default live viewer:
50
51 <pre class="term">
52 lttng view
53 </pre>
54
55 The correct arguments are passed to the live viewer so that it
56 may connect to the local relay daemon and start reading live events.
57
58 You may also wish to use a live viewer not running on the target
59 system. In this case, you should specify a network output when using
60 the `create` command (`--set-url` or `--ctrl-url`/`--data-url` options).
61 A distant LTTng relay daemon should also be started to receive control
62 and trace data. By default, `lttng-relayd` listens on 127.0.0.1:5344
63 for an LTTng live connection. Otherwise, the desired URL may be
64 specified using its `--live-port` option.
65
66 The
67 <a href="http://www.efficios.com/babeltrace" class="ext">`babeltrace`</a>
68 viewer supports LTTng live as one of its input formats. `babeltrace` is
69 the default viewer when using `lttng view`. To use it manually, first
70 list active tracing sessions by doing the following (assuming the relay
71 daemon to connect to runs on the same host):
72
73 <pre class="term">
74 babeltrace --input-format lttng-live net://localhost
75 </pre>
76
77 Then, choose a tracing session and start viewing events as they arrive
78 using LTTng live:
79
80 <pre class="term">
81 babeltrace --input-format lttng-live net://localhost/host/hostname/my-session
82 </pre>
This page took 0.03148 seconds and 4 git commands to generate.