Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure CNI plugin to log to a file #8892

Closed
mateiidavid opened this issue Jul 14, 2022 · 3 comments
Closed

Configure CNI plugin to log to a file #8892

mateiidavid opened this issue Jul 14, 2022 · 3 comments

Comments

@mateiidavid
Copy link
Member

mateiidavid commented Jul 14, 2022

Our CNI plugin currently only logs to stderr:

// Must log to Stderr because the CNI runtime uses Stdout as its state
logrus.SetOutput(os.Stderr)

CNI plugins run directly on the host, which makes it hard to access log -- and impossible to do through kubectl logs -- and operators would have to rely on reading through the kubelet log which contains a lot of verbosity.

We should dump the logs into a file (either by default or through an option) to make it easier for people to collect logs when something goes wrong. We should be consistent with other CNI implementations, such as Calico, and save logs to /var/log/linkerd-cni.

As an implementation idea, I'd consider something like:

-       logrus.SetOutput(os.Stderr)
+       f, err := os.OpenFile("/var/log/linkerd-cni", os.O_WRONLY|os.O_CREATE, 0755)
+       if err != nil {
+               panic("failed to create file")
+       }
+       logw := io.MultiWriter(os.Stderr, f)
+       logrus.SetOutput(logw)
@stale
Copy link

stale bot commented Oct 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 12, 2022
@stale
Copy link

stale bot commented Jan 11, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 11, 2023
@adleong adleong removed the wontfix label Jan 12, 2023
@stale
Copy link

stale bot commented Apr 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 17, 2023
@stale stale bot closed this as completed May 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants