-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add new "--log-to-stdout" CLI flag #460
Conversation
When this flag is used, agent will output all the log files to stdout, in addition to the log files. This comes handy in local development environment and while troubleshooting various issues.
throw in such scenario.
Codecov Report
@@ Coverage Diff @@
## master #460 +/- ##
==========================================
+ Coverage 67.88% 67.92% +0.04%
==========================================
Files 107 107
Lines 26981 27012 +31
Branches 3284 3283 -1
==========================================
+ Hits 18314 18347 +33
Misses 7797 7797
+ Partials 870 868 -2
|
@czerwingithub What's your take on this? I think it's reasonable and something I missed from the agent. Most of the Unix daemons which have foreground / no-fork mode usually also have an option to log things to stdout instead of log files. Usually that's also the default behavior when "foreground" mode is used, but I know this really won't work for us because our agent relies on logs being written to disk so we can ship them to Scalyr API. |
9d304b9
to
6419a8d
Compare
I hear what you are saying about the expected behavior of non-forked processes. Maybe we should strive to respect that. So, I have a little different take on this. Let me know what you think.
I know #2 is a little odd, but only we'd have to really use it when defining the container images we publish. Thoughts? |
One idea I had is to avoid any new flags at all we could use the "log only things above some severity to stdout" functionality in place of it. By default we could have no-fork processes log A concern I have with this idea is that people upgrading their k8s agents wouldn't update their config and would get everything logged to |
I think you might be onto something there Yan. I like that idea and I'll add one new twist to it.. but I don't know if it will work. It is possible in Dockerfiles to define values for environment variables. If we define an ENV variable for our K8s container images, will that be used if the user has not explicitly set a value for that variable in the configmap? If so, then we don't need to set it in the K8s config but instead in the actual container images.. so we won't have that config divergence problem you alluded to. |
That actually sounds perfect! I will let @Kami comment on it as well but I think thats the way to go. |
@yanscalyr You might want to make sure it works... an ENV variable defined in your container is available in K8s... and that you can override it by defining variables in the K8s config. You could do a small experiment and see. |
@yanscalyr That approach sounds good to me 👍 And ideally, for development / testing purposes you could also control this level / severity setting. |
@yanscalyr How do you want me to proceed with this PR? Should I close it? Should we merge it? Will you incorporate it into your changes? |
@Kami probably just close this PR, the work is pretty duplicate with mine and mine is also almost ready. |
This pull request adds new
--log-to-stdout
flag to the agent which can be used in combination with the existing--no-fork
flag.When this flag is used, the agent will log all the messages to stdout.
This comes handy in various scenarios such as when troubleshooting things and for local development.
In builds on top of my comments from #415.
TODO