This repository has been archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "cc-log-parser" tool that reads multiple logfmt [*] logfiles and writes their output in time order showing time differences between log entries. Fixes #578. [*] - https://brandur.org/logfmt Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
- Loading branch information
1 parent
866c9a7
commit 5c59ecb
Showing
74 changed files
with
15,035 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
## Gopkg.toml example (these lines may be deleted) | ||
|
||
## "metadata" defines metadata about the project that could be used by other independent | ||
## systems. The metadata defined here will be ignored by dep. | ||
# [metadata] | ||
# key1 = "value that convey data to other systems" | ||
# system1-data = "value that is used by a system" | ||
# system2-data = "value that is used by another system" | ||
|
||
## "required" lists a set of packages (not projects) that must be included in | ||
## Gopkg.lock. This list is merged with the set of packages imported by the current | ||
## project. Use it when your project needs a package it doesn't explicitly import - | ||
## including "main" packages. | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
|
||
## "ignored" lists a set of packages (not projects) that are ignored when | ||
## dep statically analyzes source code. Ignored packages can be in this project, | ||
## or in a dependency. | ||
# ignored = ["github.com/user/project/badpkg"] | ||
|
||
## Constraints are rules for how directly imported projects | ||
## may be incorporated into the depgraph. They are respected by | ||
## dep whether coming from the Gopkg.toml of the current project or a dependency. | ||
# [[constraint]] | ||
## Required: the root import path of the project being constrained. | ||
# name = "github.com/user/project" | ||
# | ||
## Recommended: the version constraint to enforce for the project. | ||
## Only one of "branch", "version" or "revision" can be specified. | ||
# version = "1.0.0" | ||
# branch = "master" | ||
# revision = "abc123" | ||
# | ||
## Optional: an alternate location (URL or import path) for the project's source. | ||
# source = "https://github.com/myfork/package.git" | ||
# | ||
## "metadata" defines metadata about the dependency or override that could be used | ||
## by other independent systems. The metadata defined here will be ignored by dep. | ||
# [metadata] | ||
# key1 = "value that convey data to other systems" | ||
# system1-data = "value that is used by a system" | ||
# system2-data = "value that is used by another system" | ||
|
||
## Overrides have the same structure as [[constraint]], but supersede all | ||
## [[constraint]] declarations from all projects. Only [[override]] from | ||
## the current project's are applied. | ||
## | ||
## Overrides are a sledgehammer. Use them only as a last resort. | ||
# [[override]] | ||
## Required: the root import path of the project being constrained. | ||
# name = "github.com/user/project" | ||
# | ||
## Optional: specifying a version constraint override will cause all other | ||
## constraints on this project to be ignored; only the overridden constraint | ||
## need be satisfied. | ||
## Again, only one of "branch", "version" or "revision" can be specified. | ||
# version = "1.0.0" | ||
# branch = "master" | ||
# revision = "abc123" | ||
# | ||
## Optional: specifying an alternate source location as an override will | ||
## enforce that the alternate location is used for that project, regardless of | ||
## what source location any dependent projects specify. | ||
# source = "https://github.com/myfork/package.git" | ||
|
||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/go-logfmt/logfmt" | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/urfave/cli" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2017 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
TARGET = cc-log-parser | ||
SOURCES = $(shell find . 2>&1 | grep -E '.*\.go$$') | ||
|
||
VERSION := ${shell cat ./VERSION} | ||
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true) | ||
COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}") | ||
|
||
default: $(TARGET) | ||
|
||
$(TARGET): $(SOURCES) | ||
go test . | ||
go install -ldflags "-X main.commit=${COMMIT} -X main.version=${VERSION}" . | ||
|
||
clean: | ||
rm -f $(TARGET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# `cc-log-parser` | ||
|
||
`cc-log-parser` is a tool that combines log files from various Clear | ||
Containers components. It sorts the logfiles by timestamp and re-displays | ||
them, adding a time delta showing how much time has elapsed between each log | ||
entry. | ||
|
||
## Component logfiles | ||
|
||
The primary logfiles the tool reads are: | ||
|
||
- The [runtime global log](https://github.com/clearcontainers/runtime#debugging). | ||
- The [proxy log](https://github.com/clearcontainers/proxy#debugging), which | ||
comes from the system log. | ||
- The shim log, which comes from the system log. | ||
|
||
The [virtcontainers](https://github.com/containers/virtcontainers) logs are | ||
automatically added to the runtimes global log. | ||
|
||
The [agent](https://github.com/clearcontainers/agent) logs are encoded inside | ||
the proxies log. The `cc-log-parser` tool automatically unpacks these and | ||
displays only the agent log for these messages (the proxy message that | ||
encapsulates an agent message is discarded). | ||
|
||
## Usage | ||
|
||
To merge together all logs: | ||
|
||
1. [Enable global logging](https://github.com/clearcontainers/runtime#debugging) in the runtime configuration file. | ||
1. [Enable shim debug output](https://github.com/clearcontainers/runtime#debugging) in the configuration file. | ||
1. [Enable debug logging](https://github.com/clearcontainers/proxy#debugging) for the proxy. | ||
1. Clear the systemd journal (optional): | ||
``` | ||
$ sudo systemctl stop systemd-journald | ||
$ sudo rm -f /var/log/journal/*/* /run/log/journal/*/* | ||
$ sudo systemctl start systemd-journald | ||
``` | ||
1. Create a container. | ||
1. Collect the logs. | ||
1. Save the proxy log (which also includes agent log details): | ||
``` | ||
$ sudo journalctl -q -o cat -a -u cc-proxy |grep time= > ./proxy.log | ||
``` | ||
1. Save the shim log: | ||
``` | ||
$ sudo journalctl -q -o cat -a -t cc-shim > ./shim.log | ||
``` | ||
1. Save the runtime log: | ||
``` | ||
$ sudo cp /var/lib/clear-containers/runtime/runtime.log ./runtime.log | ||
``` | ||
1. Ensure the logs are readable: | ||
``` | ||
$ sudo chown $USER *.log | ||
``` | ||
1. Run the script: | ||
``` | ||
$ cc-log-parser proxy.log shim.log runtime.log | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.1 |
Oops, something went wrong.