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

Log file option #261

Closed
carlivar opened this issue Jul 28, 2014 · 4 comments
Closed

Log file option #261

carlivar opened this issue Jul 28, 2014 · 4 comments

Comments

@carlivar
Copy link

Syslog support was added in #105 but that issue also asked for a log file option. I'd like this also.

Why do I want this? I'm in an old-school CentOS 5 & 6 init.d based environment. Snazzy new things like systemd and upstart aren't available which probably do a good job of capturing stdout/stderr to a file. runit is a possibility but I'm not thrilled about building and installing that just for Consul.

So what's exactly the problem? I can only log to a file now through appending stdout & stderr to a file and backgrounding the Consul process. Works great... until I want to use logrotate to rotate that file. I realized the only way I can release the file handle is a hard restart of Consul. That's not ideal, but possible. And then I realized, if I want to rotate logs regularly by time instead of size, all of my Consul agents could potentially be hard restarted at the same time by logrotate in order to release the file handle. Ouch.

I'm using syslog as a workaround, and perhaps could have syslogd log to a different file, but an explicit log file would be far simpler.

@salehe
Copy link

salehe commented Jul 28, 2014

Implementing different logging destinations in an application is generally not a good idea, IMO. There are many different requirements by different environments that could be easily (and should be) done by separate tools.
If you don't mind nodejs, you can take a look at https://github.com/dstokes/logrotate-stream. I think there should be many similar tools out there.

@jhmartin
Copy link
Contributor

The stock logrotate can also perform a copy/truncate operations which is friendlier to a process that keeps the output file open.

@carlivar
Copy link
Author

Thanks, I didn't know copy+truncate in logrotate. That's an option. And in that case this is just a "nice to have".

The main reason I filed an issue is because it was part of the request in #105 but was not implemented there.

@armon
Copy link
Member

armon commented Aug 19, 2014

Agreed. For now, we'd prefer this problem to be handled outside of Consul using external tools.

@armon armon closed this as completed Aug 19, 2014
duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
* Changelog for 0.15.0 release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants