log-parser-rs
is a tool that combines logfiles generated by the various
system components, sorts them by time stamp, and re-displays the log entries.
The tool is also able to check the validity of all log records, can re-format the logs, and output them in a different format.
For more information on the kata-log-parser
tool, use the help command:
$ kata-log-parser --help
Note this is a rewrite of the go-based
kata-log-parser
tool, and will eventually replace it.
Kata's runtime-rs
logs are JSON objects in the following format:
{"msg":"message","level":"INFO","ts":"1970-01-01T00:00:00.000000000Z","name":"kata-runtime","version":"0.1.0","pid":"0","source":"source","subsystem":"subsystem"}
However, if --ignore-missing-fields
is set, a log missing one or more of the following fields may be omitted:
level
name
version
pid
source
subsystem
Note a log entry must be on one single line, and a line must contain only one log entry.
The most valuable command line options are listed below:
-o, --output-file <OUTPUT_FILE>
File to output to. If not set, sends to stdout.--output-format <OUTPUT_FORMAT>
Sets the format of the output. Defaults tojson
, and can be set tocsv
,json
,ron
,text
,toml
,xml
, andyaml
.-q, --quiet
Will not print invalid log entry errors to stderr.-s, --strict
Any invalid log entry will halt the program.
For a comprehensive (and guaranteed up to date) list, please run log-parser-rs --help
.
- Make sure containerd is in debug mode
- Make sure you are running runtime-rs:
$ containerd-shim-kata-v2 --version|grep -qi rust && echo rust || echo golang
- Collect the logs (alternatively to journal clearing you may consider constraining collected logs by adding
--since=<container creation time>
).$ sudo journalctl -q -o cat -a -t kata | grep "^{" > ./kata.log ./kata.log
- Ensure the logs are readable:
$ sudo chown $USER *.log
- Process the logs:
$ log-parser-rs kata.log -o out.log