5 We have seen how trace files may be produced by LTTng out of generated
6 application and Linux kernel events. We have seen that those trace files
7 may be either recorded locally by consumer daemons or remotely using
8 a relay daemon. And we have seen that the maximum size and count of
9 trace files is configurable for each channel. With all those features,
10 it's still not possible to read a trace file as it is being written
11 because it could be incomplete and appear corrupted to the viewer.
12 There is a way to view events as they arrive, however: using
15 LTTng live is implemented, in LTTng, solely on the relay daemon side.
16 As trace data is sent over the network to a relay daemon by a (possibly
17 remote) consumer daemon, a _tee_ may be created: trace data will be
18 recorded to trace files _as well as_ being transmitted to a
19 connected live viewer:
21 <div class="img img-90">
22 <object data="/images/docs/lttng-live-relayd.svg" type="image/svg+xml">
23 <img src="/images/docs/lttng-live-relayd.svg">
27 In order to use this feature, a tracing session must created in live
28 mode on the target system:
34 An optional parameter may be passed to `--live` to set the interval
35 of time (in microseconds) between flushes to the network
36 (1 second is the default):
39 lttng create --live 100000
42 will flush every 100 ms.
44 If no network output is specified to the `create` command, a local
45 relay daemon will be spawned. In this very common case, viewing a live
46 trace is easy: enable events and start tracing as usual, then use
47 `lttng view` to start the default live viewer:
53 The correct arguments will be passed to the live viewer so that it
54 may connect to the local relay daemon and start reading live events.
56 You may also wish to use a live viewer not running on the target
57 system. In this case, you should specify a network output when using
58 the `create` command (`--set-url` or `--ctrl-url`/`--data-url` options).
59 A distant LTTng relay daemon should also be started to receive control
60 and trace data. By default, `lttng-relayd` listens on 127.0.0.1:5344
61 for an LTTng live connection. Otherwise, the desired URL may be
62 specified using its `--live-port` option.
65 <a href="http://www.efficios.com/babeltrace" class="ext">`babeltrace`</a>
66 viewer supports LTTng live as one of its input formats. `babeltrace` is
67 the default viewer when using `lttng view`. To use it manually, first
68 list active tracing sessions by doing the following (assuming the relay
69 daemon to connect to runs on the same host):
72 babeltrace --input-format lttng-live net://localhost
75 Then, choose a tracing session and start viewing events as they arrive
76 using LTTng live, e.g.:
79 babeltrace --input-format lttng-live net://localhost/host/hostname/my-session