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

cmd: Add log parser #590

Closed

Conversation

jodh-intel
Copy link
Contributor

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

@jodh-intel
Copy link
Contributor Author

Note the FIXME but it's benign - we can simply remove one of the time formats once clearcontainers/runtime#652 lands.

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

To merge together all logs:

1. Enable global logging in the runtime
1. Enable debug logging for the proxy.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! 😄 if you uses 1., it triggers markdown to auto-number. If you click on the [View] button, you'll see they get magically updated ;)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch! yep sorry

@jodh-intel
Copy link
Contributor Author

The FIXME is now fixed! ;)

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jodh-intel
Copy link
Contributor Author

Hi @iphutch - please could you review the README on this PR (https://github.com/clearcontainers/tests/pull/590/files#diff-c294cba5b0c553706556ef34aa2e7429)?

@chavafg
Copy link
Contributor

chavafg commented Oct 9, 2017

@jodh-intel, tried this tool and got an error when merging logs from proxy and runtime:

cloud@ubuntu-dev:~$ ./go/bin/cc-log-parser proxy.log runtime.log 
ERROR: agent log entry unpack failed for {TimeDelta:0s Filename:proxy.log Line:5 CCLogEntry:{Time:2017-10-09 07:27:56.798534493 +0000 UTC Pid:0 Level:debug Msg:[    0.317409] brd: module loaded Source:qemu Name: Data:map[vm:7ddcff5ec12e9e2f00ca5c8957b4df794e2c5efe2eb63f3cfea1506fe1ebd64c]}}: invalid character 'b' after top-level value

I have the -log debug option for the cc-proxy service and
enable_debug = true on the runtime configuration.toml

@jodh-intel
Copy link
Contributor Author

Hi @chavafg - thanks for testing. I think the problem you are seeing is because the latest clear-containers.img file doesn't yet have the required fixes. In fact, I'm a bit confused as the latest seems to be 17270 according to:

... but that was from 23 August:

@jcvenegas, @gorozco1 - am I getting confused here or do we need to update the image (I thought we were doing it weekly as part of the release process)? Which reminds me: clearcontainers/runtime#632 :)

@jcvenegas
Copy link
Contributor

@jodh-intel the image was not updated last week, the agent was not tagged for a release, I updated to master anyway on Friday, let me send a PR to updated.

@jodh-intel
Copy link
Contributor Author

Thanks @jcvenegas!

@jcvenegas
Copy link
Contributor

@jodh-intel and ouch let me write a docuement about image update.

Copy link

@iphutch iphutch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An indentation, wording suggestion, and note. Indentation and wording is all that needs to be changed.


The primary two logs that are passed to the tool are the [runtime global
log](https://github.com/clearcontainers/runtime#debugging) and the [proxy
log](https://github.com/clearcontainers/proxy#debugging).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note:
This wrapping doesn't break anything because it is within the rendered text, however, note that you can ignore 78char rules when it is a link taking you over the max. It's fine as is but should the 78 char mark hit outside of the square brackets, you would wrap text before or after the full
[runtime global log](https://github.com/clearcontainers/runtime#debugging)

automatically added to the runtimes global log.

The [agent](https://github.com/clearcontainers/agent) logs are encoded inside
the proxies log. The tool automatically unpacks these and displays only the
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/The tool/The cc-log-parser tool
OR
s/The tool/cc-log-parser

$ sudo cp /var/lib/clear-containers/runtime/runtime.log ./runtime.log
```
1. Run the script
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent this code block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing @iphutch - branch updated.

@jodh-intel jodh-intel force-pushed the add-log-parser-tool branch 2 times, most recently from 9548146 to 34e9873 Compare October 10, 2017 08:08
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

1 similar comment
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

Copy link

@iphutch iphutch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README looks great

@jodh-intel
Copy link
Contributor Author

Hi @iphutch - branch updated.

@jodh-intel
Copy link
Contributor Author

Failing on F26 due to the kill_test.go issue:

• Failure [18.183 seconds]
docker kill
/home/jenkins/go/src/github.com/clearcontainers/tests/integration/docker/kill_test.go:129
  killing container
  /home/jenkins/go/src/github.com/clearcontainers/tests/vendor/github.com/onsi/ginkgo/extensions/table/table.go:96
    with '1' signal [It]
    /home/jenkins/go/src/github.com/clearcontainers/tests/vendor/github.com/onsi/ginkgo/extensions/table/table_entry.go:46

    Expected
        <int>: 0
    to equal
        <int>: 1

    /home/jenkins/go/src/github.com/clearcontainers/tests/integration/docker/kill_test.go:95

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jodh-intel
Copy link
Contributor Author

Branch updated now that the shim also produces structured logs (clearcontainers/shim#84).

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jodh-intel
Copy link
Contributor Author

As mentioned on #603, unless you use https://github.com/clearcontainers/osbuilder, you'll need to use clear-18220-containers.img or newer for the agent unpack to work.

@jodh-intel
Copy link
Contributor Author

jodh-intel commented Oct 12, 2017

Found a bug - the agent unpack doesn't work if you have hypervisor debug enabled in the runtime config file, so you'll need to ensure that enable_debug= option is either commented out or set to false.

I'll see if there is a clean way to add a new field for hypervisor output that can be added so cc-log-parser can distinguish hypervisor boot output from other output...

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@chavafg
Copy link
Contributor

chavafg commented Oct 12, 2017

hi @jodh-intel , did you find a way to solve the issue you described above? or should we add in the README a statement to indicate not use with enable_debug = true

@jodh-intel
Copy link
Contributor Author

Hi @chavafg - yes, I've found a way and updated the branch.

To test it fully, you'll need to use the latest shim built from source (./configure && make && sudo make install) and then you'll need to change the runtime config to use that shim:

[shim.cc]
path = "/usr/local/libexec/cc-shim"

But alternatively, just don't pass cc-log-parser a shim.log ;)

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

1 similar comment
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

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 clearcontainers#578.

[*] - https://brandur.org/logfmt

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jodh-intel
Copy link
Contributor Author

Hi @chavafg - does this work for you now?

@chavafg
Copy link
Contributor

chavafg commented Oct 16, 2017

Hi @jodh-intel, unfortunately still have issues:

I am running with enable_debug = true using Clear Containers image 18250.

cloud@ubuntu-dev:~$ ~/go/bin/cc-log-parser proxy.log runtime.log shim.log 
ERROR: logfmt syntax error at pos 127 on line 516: invalid quoted value

Taking a look at the log files, the only file which has 516 lines is the proxy, and the error is because of this line:

time="2017-10-16T05:33:51.308880831Z" level=debug msg="Welcome to \\x1b[1;35mClear Linux OS for Intel Architecture\\x1b[0m!" name=cc-proxy pid=1899 source=qemu vm=7276d3d7548b4f72831a3f7f5ea86016bbdfbf1db0dd    c75c923af61c69e17770

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

1 similar comment
@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@jodh-intel
Copy link
Contributor Author

I'm going to close this PR as the plan is now to move the tool to https://github.com/kata-containers/tests/.

@jodh-intel
Copy link
Contributor Author

Replaced by kata-containers/tests#98.

mcastelino pushed a commit to mcastelino/tests that referenced this pull request Jan 23, 2019
metrics: Add bidirectional iperf network bandwidth
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants