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

Logging system for kata-containers #3

Closed
gnawux opened this issue Nov 22, 2017 · 11 comments
Closed

Logging system for kata-containers #3

gnawux opened this issue Nov 22, 2017 · 11 comments

Comments

@gnawux
Copy link
Member

gnawux commented Nov 22, 2017

Now we have logrus and glog as candidate, both are widely used in the golang world. We all agree the logrus are more flexible and powerful. However, glog is come from Google, and used by most of the kubernetes family projects.

The question is, could we wrapped the log engine, which allows the users could select log engine if they import kata code as vendor?

@gnawux
Copy link
Member Author

gnawux commented Nov 22, 2017

As discussed in the meeting, I created the issue, correct me if there is anything wrong.
@laijs @bergwolf @sboeuf @jodh-intel @sameo

@grahamwhaley
Copy link
Contributor

A quick github search turned up this:
https://github.com/bookerzzz/glog
Not sure if that will be of use...?

@grahamwhaley
Copy link
Contributor

or (/me goes to check)... is that the same glog. hmm...

@sboeuf
Copy link

sboeuf commented Nov 22, 2017

@grahamwhaley it creates an implementation of the glog interface it seems.

@gnawux
Copy link
Member Author

gnawux commented Nov 29, 2017

Since there is no more discussion on this topic, I wrote a log adapter to allow using glog as the output of logrus: https://github.com/gnawux/glog4logrus

then we could coding with logrus and log to logrus or glog as required. Any comments?

@sameo
Copy link

sameo commented Nov 29, 2017

@gnawux Thanks a lot.
So would the typical usage for exported Kata Containers component be:

  1. Import github.com/gnawux/glog4logrus
  2. When starting the component, call:
        logrus.SetLevel(glog4logrus.GlogLevel())
	logrus.SetFormatter(&glog4logrus.GlogFormatter{})
	logrus.SetOutput(&glog4logrus.GlogOuptut{})

@WeiZhang555
Copy link
Member

Or should we expose an option to user and let user choose which log system to use?

For example:

--log-driver=logrus:json-file
--log-driver=glog:text

@gnawux
Copy link
Member Author

gnawux commented Nov 30, 2017

@sameo @WeiZhang555 The simple answer is No.

I used to think about such ways. However, if you read more glog code, you will found --

glog has a init() method, which will insert some flags to your binary, such as -v, -logtostderr, etc. I guess you don't want to have these flags if you wan to use native
logrus, however, you have to run the init() if you import glog no matter whether
you log with it.

Then how to use glog4logrus, my assumption is ---

If you have a program use kata as a library, say hyperd here (just for illustration), and you
want use glog, because k8s use glog as well, it is reasonable to have all the binaries
output logs in the same manner. When the hyperd call kata as a lib, it could set the logrus
format and output driver with glog4logrus.

Let me summary here:

  • kata components use logrus, and provide method to setup logrus (this should not be a problem).
  • kata components don't import glog4logrus
  • If a guest code want to use glog, then they must have already imported glog, and they could import glog4logrus and configure logrus to export to glog.

@sameo
Copy link

sameo commented Nov 30, 2017

@gnawux I think this is the right approach, thanks for the clarification.

@WeiZhang555
Copy link
Member

Yeah, sounds quite good 👍

@egernst
Copy link
Member

egernst commented Feb 13, 2018

Seems we have agreement based on @gnawux's proposal. Closing this resolved issue.

@egernst egernst closed this as completed Feb 13, 2018
jodh-intel pushed a commit to jodh-intel/runtimes that referenced this issue Mar 14, 2018
mcastelino referenced this issue in mcastelino/runtime-1 Dec 6, 2018
HACK: The VmPath is not getting properly populated
sboeuf pushed a commit to sboeuf/runtime-1 that referenced this issue Dec 20, 2018
jcvenegas pushed a commit that referenced this issue Dec 2, 2019
Merge #3 of kata-containers/runtime
katabuilder pushed a commit to katabuilder/runtime that referenced this issue Dec 9, 2019
- versions: bump firecracker version
- clh: use http client
- rootless: Disable vhost-net for rootless
- compatoci: Add a SetLogger call
- virtiofs: stop sandbox when virtiofsd quits
- vc: Remove device when AddDevice encounters error
- kernel: update to 4.19.83
- Cloud Hypervisor: driver update number 2
- vc: Use map to represent ignoredMounts
- Fc comment
- vc: Check return value from os.MkdirAll in virtiofsdArgs
- vc: Drop Sandbox#Pause and Sandbox#Resume
- vc: Use map built-in accessor to find container in Sandbox#GetContainer
- Makefile: fix suspicious line
- k8s: fix wrong number cpus after killing a container
- vc: Utilize map for newMounts to speed up replaceOCIMountSource
- vc: Sandbox#getAndSetSandboxBlockIndex shouldn't alter BlockIndex in case of error
- virtcontainers: rename GetOCISpec to GetPatchedOCISpec
- tracing: Unbreak tracing test
- fc.go: Set firecracker log level to debug if hypervisor.enable_debug …
- virtcontainers: honour ContainerConfig struct comment and don't save OCI spec
- virtcontainers: improve algorithm to find containers
- Merge kata-containers#3 of kata-containers/runtime
- FC: extract error info from firecracker built-in log and metrics scheme
- gitignore: include cloud hypervisor configuration toml
- Respect containerd's debug config
- Clh driver: removed hard-coded vsock contextid (cid)
- vc: Persist file handle may leak in FS#ToDisk
- vc: Clean up directories in case MkdirAll fails
- vc: Restore sandbox state when there is error starting containers
- vc: Persist file handle may leak in FS#FromDisk
- sync fork after merge clh driver kata-containers#1

810c2c9 versions: bump firecracker version
0afeb52 clh: clh http  unit test
42061f6 clh: cleanup VM dir
c688a15 version: CH bump to master
9f15dd2 clh: remove cli builder
f73723a clh: use http client
0babd38 rootless: Disable vhost-net for rootless
6010218 clh: Implement check()
a10da3e vendor: update openapi deps
1836226 clh: generate client code
dcac021 clh: Add Generation tools for API client
abbb536 virtiofs: stop sandbox when virtiofsd quits
9c0872d vc: Remove device when AddDevice encounters error
67f203f compatoci: Add a SetLogger call
bec46bb vc: Use map to represent ignoredMounts
628799a vc: Check return value from os.MkdirAll in virtiofsdArgs
9dd3f13 Makefile: Move the .git-commit: rule block to below the all: rule
7bcce3d Makefile: do not use tabs in if/else blocks
38224e8 vc: Use map built-in accessor to find container in Sandbox#GetContainer
544730b vc: Drop Sandbox#Pause and Sandbox#Resume
d4be097 Makefile: fix suspicious line
e8cc87b clh: basic/unit tests for clh driver
0697124 fc: update comments for startSandbox
3ef8f6c clh: fixes erroneous killing of virtiofsd
6af127f clh: improve driver logging for failed hypervisor
c58e6f9 kernel: update to 4.19.86
b7731e9 virtcontainers: don't consider non-running container resources
43f0513 virtcontainers: update resources after adding container to sandbox
613fd0f virtcontainers: rename GetOCISpec to GetPatchedOCISpec
330cc72 tracing: Unbreak tracing test
191ee63 fc.go: Set fc log level to debug if hypervisor.enable_debug is true
336edf7 virtcontainers: honour ContainerConfig struct comment and not save Spec
7f67b9f virtcontainers: improve algorithm to find containers
0ac4355 gitignore: include cloud hypervisor configuration toml
1abe52a clh: removed hard-coded vsock contextid (cid)
c833ac2 vc: BlockIndex should not be altered in case of error
b8b6733 vc: Persist file handle may leak in FS#ToDisk
03478d4 vc: Clean up directories in case MkdirAll fails
51d7c23 shim: Respect containerd's debug config
93a0336 vc: Restore sandbox state when there is error starting containers
2331e87 vc: Persist file handle may leak in FS#FromDisk
9a4ee4f vc: Utilize map for newMounts to speed up replaceOCIMountSource
daae1db log: extract error info from firecracker built-in log and metrics scheme

Signed-off-by: katacontainersbot <katacontainersbot@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants