Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 001ed84

Browse files
author
James O. D. Hunt
committed
doc: Update agent and kernel debug documents
The agent and kernel debug documents had deviated from reality. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
1 parent aa0f49c commit 001ed84

2 files changed

Lines changed: 46 additions & 51 deletions

File tree

docs/debug-agent.md

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,43 @@ Clear Containers runtime launch a special virtual machine when a new pod is
44
created. This VM uses a VM-agent to spawn processes on behalf of the
55
pod/container(s) running inside the VM.
66

7-
From Clear Containers 3.0-beta release a new agent is used,
8-
[Clear Containers Agent](https://github.com/clearcontainers/agent):
7+
From Clear Containers 3.0-beta release a new agent (`cc-agent`) is used,
8+
[Clear Containers Agent](https://github.com/clearcontainers/agent).
99

10-
The Clear Containers Agent relies heavily on libcontainer used by runc
11-
(standard program when running containers on bare metal).
10+
The Clear Containers agent relies heavily on [`libcontainer`](https://github.com/opencontainers/runc/tree/master/libcontainer) used by [`runc`](https://github.com/opencontainers/runc/) (standard program when running containers on bare metal).
1211

1312
To provide a debug log of any agent activity on a guest, the Clear Containers
1413
agent sends logs through a QEMU serial console that are collected by [cc-proxy](https://github.com/clearcontainers/proxy)
1514
and shown in its logs. By default, the Clear Containers agent logs are not collected by
16-
`cc-proxy` but can be enabled by adding the `-log debug` option to `cc-proxy`.
17-
18-
1- Add the `-log debug` option to `cc-proxy`
19-
20-
```
21-
mkdir -p /etc/systemd/system/cc-proxy.service.d/
22-
cat << EOT > /etc/systemd/system/cc-proxy.service.d/proxy-debug.conf
23-
[Service]
24-
ExecStart=
25-
ExecStart=/usr/libexec/clear-containers/cc-proxy -log debug
26-
EOT
27-
# Restart cc-proxy to provide debug logs.
28-
systemctl daemon-reload
29-
systemctl restart cc-proxy
30-
```
31-
2- Run a container to generate the agent debug logs
32-
33-
```
34-
sudo docker run -ti busybox true
35-
```
36-
3- Filter the agent debug logs from the `cc-proxy` logs
37-
The `cc-proxy` logs show the sources of its collated information. To only see
38-
the agent debug logs, filter `cc-proxy` logs by the QEMU serial console (the
39-
agent logs were sent through it). The QEMU serial console is represented by
40-
`source=qemu`.
41-
42-
```
43-
journalctl -u cc-proxy | grep source=qemu
44-
```
45-
46-
The debug log format is:
47-
DEBU[0019] *AGENT MESSAGE* source=qemu vm=*CONTAINER_ID*
15+
`cc-proxy` but can be enabled by enabling the proxy debug option.
16+
17+
1. Enable proxy debug
18+
19+
Set the `enable_debug=` option in the `[proxy.cc]` section to `true` (assumes a standard configuration file path):
20+
21+
```
22+
$ sudo awk '{if (/^\[proxy\.cc\]/) {got=1}; if (got == 1 && /^#enable_debug/) {print "enable_debug = true"; got=0; next; } else {print}}' /usr/share/defaults/clear-containers/configuration.toml
23+
```
24+
25+
1. Run a container to generate the logs:
26+
27+
```
28+
$ sudo docker run -ti busybox true
29+
```
30+
31+
1. Filter the agent debug logs from the `cc-proxy` logs
32+
33+
The `cc-proxy` logs show the sources of its collated information. To only see
34+
the agent debug logs, filter `cc-proxy` logs by the QEMU serial console (the
35+
agent logs were sent through it). The QEMU serial console is represented by
36+
`source=qemu`.
37+
38+
```
39+
$ sudo journalctl -t cc-proxy | grep source=qemu | egrep '\<cc-agent\>'
40+
```
41+
42+
To extract all logs entries for a particular container:
43+
44+
```
45+
$ sudo sudo journalctl -t cc-proxy | grep source=qemu | grep vm=CONTAINER_ID | egrep '\<cc-agent\>'
46+
```

docs/debug-kernel.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,33 @@ fails due to the kernel.
1010
To provide a debug log of the kernel boot, Clear Containers supports an option
1111
to enable kernel boot logs using the configuration file.
1212

13-
1. Enable debug in `configuration.toml`
13+
1. Enable kernel boot messages
14+
15+
Set the `enable_debug=` option in the `[proxy.cc]` section to `true` (assumes a standard configuration file path):
1416

1517
```
16-
$ enable_debug = true
18+
$ sudo awk '{if (/^\[proxy\.cc\]/) {got=1}; if (got == 1 && /^#enable_debug/) {print "enable_debug = true"; got=0; next; } else {print}}' /usr/share/defaults/clear-containers/configuration.toml
1719
```
1820

19-
2. Run a container to generate the logs
21+
1. Run a container to generate the logs
2022

2123
```
2224
$ sudo docker run -ti busybox true
2325
```
2426

25-
3. Filter the kernel boot logs from the `cc-proxy` logs
27+
1. Filter the kernel boot logs from the `cc-proxy` logs
2628

2729
The `cc-proxy` logs show the sources of its collated information. To see
28-
the kernel boot logs, filter `cc-proxy` logs by the QEMU serial console.
30+
the kernel boot logs, filter `cc-proxy` logs by the QEMU serial console,
31+
excluding the agent messages.
2932
The QEMU serial console is represented by `source=qemu`.
3033

3134
```
32-
$ journalctl -u cc-proxy | grep source=qemu
35+
$ sudo journalctl -t cc-proxy | grep source=qemu | egrep -v '\<cc-agent\>'
3336
```
3437

35-
4. Obtain logs using standalone `cc-proxy`
36-
37-
In some cases it may be easier to run the `cc-proxy` standalone by first stopping
38-
the `cc-proxy` service and running it standalone to capture the logs.
38+
To extract all logs entries for a particular container:
3939

4040
```
41-
$ sudo systemctl stop cc-proxy
42-
$ sudo /usr/libexec/clear-containers/cc-proxy -log debug
41+
$ sudo sudo journalctl -t cc-proxy | grep source=qemu | grep vm=CONTAINER_ID | egrep -v '\<cc-agent\>'
4342
```
44-
45-
This will result in the `cc-proxy` log being printed on the terminal. This method
46-
can also be used to capture the logs in a specific `cc-proxy` file.

0 commit comments

Comments
 (0)