| 1 | --- |
| 2 | id: sending-trace-data-over-the-network |
| 3 | --- |
| 4 | |
| 5 | The possibility of sending trace data over the network comes as a |
| 6 | built-in feature of LTTng-tools. For this to be possible, an LTTng |
| 7 | _relay daemon_ must be executed and listening on the machine where |
| 8 | trace data is to be received, and the user must create a tracing |
| 9 | session using appropriate options to forward trace data to the remote |
| 10 | relay daemon. |
| 11 | |
| 12 | The relay daemon listens on two different TCP ports: one for control |
| 13 | information and the other for actual trace data. |
| 14 | |
| 15 | Starting the relay daemon on the remote machine is easy: |
| 16 | |
| 17 | <pre class="term"> |
| 18 | lttng-relayd |
| 19 | </pre> |
| 20 | |
| 21 | This makes it listen to its default ports: 5342 for control and |
| 22 | 5343 for trace data. The `--control-port` and `--data-port` options may |
| 23 | be used to specify different ports. |
| 24 | |
| 25 | Traces written by `lttng-relayd` are written to |
| 26 | <code>~/lttng-traces/<em>hostname</em>/<em>session</em></code> by |
| 27 | default, where <code><em>hostname</em></code> is the host name of the |
| 28 | traced (monitored) system and <code><em>session</em></code> is the |
| 29 | tracing session name. Use the `--output` option to write trace data |
| 30 | outside `~/lttng-traces`. |
| 31 | |
| 32 | On the sending side, a tracing session must be created using the |
| 33 | `lttng` tool with the `--set-url` option to connect to the distant |
| 34 | relay daemon: |
| 35 | |
| 36 | <pre class="term"> |
| 37 | lttng create my-session --set-url net://distant-host |
| 38 | </pre> |
| 39 | |
| 40 | The URL format is described in the output of `lttng create --help`. |
| 41 | The above example uses the default ports; the `--ctrl-url` and |
| 42 | `--data-url` options may be used to set the control and data URLs |
| 43 | individually. |
| 44 | |
| 45 | Once this basic setup is completed and the connection is established, |
| 46 | you may use the `lttng` tool on the target machine as usual; everything |
| 47 | you do is transparently forwarded to the remote machine if needed. |
| 48 | For example, a parameter changing the maximum size of trace files |
| 49 | only has an effect on the distant relay daemon actually writing |
| 50 | the trace. |