Link to v2.6 images
[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
17remote) consumer daemon, a _tee_ may be created: trace data will be
18recorded to trace files _as well as_ being transmitted to a
19connected live viewer:
20
21<div class="img img-90">
4280f592
PP
22 <object data="/images/docs26/lttng-live-relayd.svg" type="image/svg+xml">
23 <img src="/images/docs26/lttng-live-relayd.svg">
5e0cbfb0
PP
24 </object>
25</div>
26
27In order to use this feature, a tracing session must created in live
28mode on the target system:
29
30<pre class="term">
31lttng create --live
32</pre>
33
34An optional parameter may be passed to `--live` to set the interval
35of time (in microseconds) between flushes to the network
36(1&nbsp;second is the default):
37
38<pre class="term">
39lttng create --live 100000
40</pre>
41
42will flush every 100&nbsp;ms.
43
44If no network output is specified to the `create` command, a local
45relay daemon will be spawned. In this very common case, viewing a live
46trace is easy: enable events and start tracing as usual, then use
47`lttng view` to start the default live viewer:
48
49<pre class="term">
50lttng view
51</pre>
52
53The correct arguments will be passed to the live viewer so that it
54may connect to the local relay daemon and start reading live events.
55
56You may also wish to use a live viewer not running on the target
57system. In this case, you should specify a network output when using
58the `create` command (`--set-url` or `--ctrl-url`/`--data-url` options).
59A distant LTTng relay daemon should also be started to receive control
60and trace data. By default, `lttng-relayd` listens on 127.0.0.1:5344
61for an LTTng live connection. Otherwise, the desired URL may be
62specified using its `--live-port` option.
63
64The
65<a href="http://www.efficios.com/babeltrace" class="ext">`babeltrace`</a>
66viewer supports LTTng live as one of its input formats. `babeltrace` is
67the default viewer when using `lttng view`. To use it manually, first
68list active tracing sessions by doing the following (assuming the relay
69daemon to connect to runs on the same host):
70
71<pre class="term">
b80ba306 72babeltrace --input-format lttng-live net://localhost
5e0cbfb0
PP
73</pre>
74
75Then, choose a tracing session and start viewing events as they arrive
76using LTTng live, e.g.:
77
78<pre class="term">
b80ba306 79babeltrace --input-format lttng-live net://localhost/host/hostname/my-session
5e0cbfb0 80</pre>
This page took 0.024724 seconds and 4 git commands to generate.