1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-03 05:57:25 +00:00
kata-containers/src/tools/log-parser-rs
Gabriela Cervantes 980d084f47 log-parser: Update log parser link at README
This PR updates the link to the correspondent Developer Guide at the
enabling full containerd debug that we have for kata 2.0 documentation.

Fixes 

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2023-06-05 15:59:52 +00:00
..
src tools: made log-parser-rs 2023-05-02 13:16:54 -05:00
Cargo.lock tools: made log-parser-rs 2023-05-02 13:16:54 -05:00
Cargo.toml tools: made log-parser-rs 2023-05-02 13:16:54 -05:00
Makefile tools: made log-parser-rs 2023-05-02 13:16:54 -05:00
README.md log-parser: Update log parser link at README 2023-06-05 15:59:52 +00:00

kata-log-parser

Introduction

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.

Log Format

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.

Command line opts

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 to json, and can be set to csv, json, ron, text, toml, xml, and yaml.
  • -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.

Usage

  1. Make sure containerd is in debug mode
  2. Make sure you are running runtime-rs:
    $ containerd-shim-kata-v2 --version|grep -qi rust && echo rust || echo golang
    
  3. 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
    
  4. Ensure the logs are readable:
    $ sudo chown $USER *.log
    
  5. Process the logs:
    $ log-parser-rs kata.log -o out.log