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