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